si ma se devi fare due liste uguali...perchè fare 2 strutture diverse?!?!? cioè perchè fare questo:
non è più logico fare così:codice:typedef struct l1{ //DICHIARAZIONE STRUTTURE int info; struct l1 *next; }*p; typedef struct l1 L1; typedef struct l2{ int info; struct l2 *next; }*q; typedef struct l2 L2;
in questo modo fai una sola struttura però poi nel main fai due puntatori alla stessa struttura...e quindi è come se avessi 2 liste...che però possono contenere le stesse informazioni....in questo modo puoi interaggire con le 2 liste e fare i cambiamenti dei puntatori tra head1 e head2!!codice:typedef struct lista { int info; struct lista *next; }Ls; int main () { Ls *head1, *head2; head1 = NULL; head2 = NULL; ......... ......... return 0; }
spero di essermi spiegato abbastanza bene...se ci sono dubbi o se non è una buona soluzione, fammi sapere...ciao

Rispondi quotando