Program to copy one linked list into another using recursion
#include #include #include /* structure containing a data part and link part */ struct node { int data ; struct node *link ; } ; void append ( struct node **, int ) ; void copy ( struct node *, struct node ** ) ; void display ( struct node * ) ; void main( ) { struct node *first, *second ; first = second = NULL ; /* empty linked lists */ append ( &first, 1 ) ; append ( &first, 2 ) ; append ( &first, 3 ) ; append ( &first, 4 ) ; append ( &first, 5 ) ; append ( &first, 6 ) ; append ( &first, 7 ) ; clrscr( ) ; display ( first ) ; copy ( first, &second ) ; display ( second ) ; } /* adds a node at the end of the linked list */ void append ( struct node **q, int num ) { struct node *temp ; temp = *q ; if ( *q == NULL ) /* if the list is empty, create first node */ { *q = malloc ( sizeof ( struct node ) ) ; temp = *q ; } else { /* go to last node */ while ( temp -> link != NULL ) temp = temp -> link ; /* add node at th...