C program please read the requirement carfully Write a func

C program

-

(please read the requirement carfully)

Write a function called copyList (), which makes a \"deep\" copy or complete copy of one singly linked list. The function should accept two parameters: a pointer to the source list and a pointer to the new list. You need to decide if the pointer to the new list is single indirection (*) or double indirection (**). The function should not return a value. You should NOT just do the following: newList = sourceList;//pseudocode You may not assume that a makeNode () function exists. A Node is defined as follows: typdef struct node {char data[100]; struct node *pNext;} Node; Be sure to fill in the function header! void copyList(Node *pSourceList, ) {

Solution

void CopyList(Node* pSourceList, Node* ©) { while (pSourceList != NULL) { { Node* copy = new Node; copy->data= pSourceList->data; copy->pNext = pSourceList->pNext; pSourceList = pSourceList->pNext; } } }
C program - (please read the requirement carfully) Write a function called copyList (), which makes a \

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site