Question: IN C PROGRAMMING: Include the code that is requested in yellow (3.9 and 3.10) as one struct person f // ..some .. struct linkedlist //We're

IN C PROGRAMMING:

Include the code that is requested in yellow (3.9 and 3.10) as one

IN C PROGRAMMING: Include the code that is requested in yellow (3.9and 3.10) as one struct person f // ..some .. struct linkedlist

struct person f // ..some .. struct linkedlist //We're now packaging the two pointers into a s struct person *front; struct person *rear; t; void print (struct person *p) //..sone.. struct person* makeNode (char* name, int age) .. same struct linkedlist* initList O struct linkedlist* L; L- (struct linkedlist*) malloc (sizeof(struct L-frontNULL; L->rear = NULL return L; linkedlist)); void addToList (struct linkedlist* L, char* name, int age) if (L->frontNULL) L-front L->rear makeNode (name, age); L->front; else L->rear->next -makeNode (name, age); L-rear L->rear->next; void printList (struct linkedlist* L) struct person "p; WRITE YOUR CODE HERE struct linkedlist* copy (struct linkedlist* L) struct person "p; struct linkedlist *L2; /WRITE YOUR CODE HERE int main C struct linkedlist *L1, *L2; L1 = initList () ; addToList (L1, "R2-D2", 609); addToList (L1, "Optimus Prime", 2700); addToList (L1, "Wall-E", 210); printList (L1); // Wrong way to copy L2 = L1 ; addToList (L2, "Hal-9000", 2); printList (L1); /Better: L2 = copy (L1); addToList (L2, "T-1000", 30); printList (L2); HW Exercise 3.9: Implement the above in linkedlistExample2.c, completing the required methods For the moment, the copy) method can remain not implemented The reason for the variation is now clear: we'd lke to make it easy to copy a linked list: .The wrong way, of course, is just to copy a pointer: L2 = L1; The right way is to create an entire new list. HW Exercise 3.10: Implement the copy) method, ensuring that a deep copy is made, so that every person struct is duplicated. Un-comment the block comments in main() Add all this code to linkedlistExample2.c

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!