Ciao ragazzi,

allora, devo leggere delle parole da un file di testo e creare una lista lineare di tali parole.

Ho definito le strutture:
codice:
 struct voce {
  char *parola;
  int frequenza;
  struct voce *next;
 }

 typedef struct voce *Lista;
Per la fase di lettura da file non ci sono problemi. Il problema sta nell'inserimento nella lista:

codice:
 void InserisciInCoda(Lista l, char *word, int freq)
 {
  if(l==NULL)
  {
   l=(struct voce *)malloc(sizeof(struct voce));
   l->parola=word;
   l->frequenza=freq;
   l->next=NULL;  
  }
  else
   InserisciInCoda(l->next,word,freq);
 }
A run-time il programma si blocca. Dov'è l'errore? Secondo voi si potrebbe risolvere in un modo migliore?

Grazie