Spero di essere d'aiuto, prova a buttare un'occhio su questo codice:
Codice Sbagliato
Codice PHP:int inserisci (struct scheda *t, int val, char *nome, char *cogn)
{
struct scheda *p;
p=(struct scheda *)malloc(sizeof(struct scheda));
if (p==NULL) return (ERRORE);
p->codice=val;
p->nome=strdup(nome);
if (p->nome==NULL) return (ERRORE);
p->cognome=strdup(cognome);
if (p->cognome==NULL) return (ERRORE);
p->succ=t;
t=p;
return (OK);
}
Codice Corretto
Programma ChiamanteCodice PHP:int inserisci (struct scheda **t, int val, char *nome, char *cogn)
{
struct scheda *p;
p=(struct scheda *)malloc(sizeof(struct scheda));
if (p==NULL) return (ERRORE);
p->codice=val;
p->nome=strdup(nome);
if (p->nome==NULL) return (ERRORE);
p->cognome=strdup(cognome);
if (p->cognome==NULL) return (ERRORE);
p->succ=*t;
*t=p;
return (OK);
}
Fammi sapere!!Codice PHP:ret=inserisci (&testa, val, nome, cognome);
![]()

Rispondi quotando