Answers for "how do you make a copy of a linked list in c"

C
0

how do you make a copy of a linked list in c

struct node *copyList(struct node *sourceList)
{
    if(sourceList==NULL) return;
    struct node *targetList=(struct node *) malloc(sizeof(struct node));
    targetList->info=sourceList->info;
    targetList->link=copy(sourceList->link);
    return targetList;
}
Posted by: Guest on April-15-2021

Code answers related to "how do you make a copy of a linked list in c"

Code answers related to "C"

Browse Popular Code Answers by Language