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));
} }
Ref: http://technical-interview.com
if(q!=NULL)
{
*s=malloc(sizeof(struct node));
(*s)->data=q->data;
(*s)->link=NULL;
copy_linked_list(q->link, &((*s)->link));
} }
Ref: http://technical-interview.com
No comments:
Post a Comment