Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Ex. 3.8: Please add to linkedlistExample.c and include a complete printList() function, and fill in a complete memory diagram right after the three nodes are
Ex. 3.8: Please add to linkedlistExample.c and include a complete printList() function, and fill in a complete memory diagram right after the three nodes are added to the list
struct person char *name int age; struct person* next; // We've added a "next" pointer struct person *front NULL, *rear NULL; // The usual front,rear pointers void print (struct person *p) printf C" Name-s age-d ", p->name, p->age); struct person* makeNode (char* name, int age) struct person *p; p (struct person*) malloc (sizeof(struct person)); p-name name p->age = age; p->next NULL; return p; void addToList (char* name, int age) if (front-NULL) { front -makeNode (name, age); rear = front else rear->next = makeNode (name, rear -rear->next age); void printList O struct person *p WRITE YOUR CODE HERE use the pointer p //to walk down the list. int main O addToList ("R2-D2", 609); addToList ("Optimus Prime", 2700); addToList ("Wall-E", 210); printList O; Exercise 3.8: Copyl/paste the above in linkedlistExample.c, including a complete printList() function, and fill in a complete memory diagram right after the three nodes are added to the ist (only include heap addresses - use the debugger to find them)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started