la funzione che aggiunge alla fine della lista è questa
codice:
/* Aggiunge un nodo di tipo MOVIE alla fine della lista*/
void inserisci_vhs(MOVIE **testaV, char *titolo, char *regista, char *genere, char *distribuzione)
{
MOVIE* nuovo_vhs = (MOVIE *) malloc(sizeof(MOVIE));
MOVIE* i;
strcpy(nuovo_vhs->titolo,titolo);
strcpy(nuovo_vhs->regista,regista);
strcpy(nuovo_vhs->genere,genere);
strcpy(nuovo_vhs->distribuzione,distribuzione);
nuovo_vhs->next = NULL;
if (*testaV == NULL)
{
*testaV = nuovo_vhs;
return;
} else
{
for (i = *testaV; i->next != NULL; i=i->next)
;
i->next = nuovo_vhs;
return;
}
}