Prego, una versione più razionale (e corretta) è questa
codice:list append( list l1, list l2 ) { list l3 = NULL; if( l1 ) { l3 = (list)malloc(sizeof(listNode)); l3->value = l1->value; l3->next = append( l1->next, l2 ); } else if( l2 ) { l3 = (list)malloc(sizeof(listNode)); l3->value = l2->value; l3->next = append( l1, l2->next ); } return l3; }

Rispondi quotando