Sunday, Nov 18th

Last update12:59:40 PM GMT

How to create a copy of a linked list? Write a C program to create a copy of a linked list.

Write e-mail

Check out this C program which creates an exact copy of a linked list.

copy_linked_lists(struct node *q, struct node **s)
{
 if(q!=NULL)
 {
 *s=malloc(sizeof(struct node));
 (*s)->data=q->data;
 (*s)->link=NULL;
 copy_linked_list(q->link, &((*s)->link));
 }
}</code>

argaiv1879

Share this post



Web Hosting