Question: void printList (nodePT L) { nodePT curr = } malloc(sizeof(struct node)); curr = L; while (curr != NULL) { 11 printf(%d, } nodePT prev

  void printList (nodePT L) { nodePT curr = } malloc(sizeof(struct node)); curr 

void printList (nodePT L) { nodePT curr = } malloc(sizeof(struct node)); curr = L; while (curr != NULL) { 11 printf("%d, } nodePT prev = curr; I curr->data); malloc(sizeof(struct node)); prev curr = curr->next; // line 1 // line 2 // line 3 // line 4 // line 5 // line 6 // line 7 O The call works without any problem. It is correct code that prints the data from each node of the given linked list, L. There will be no memory leaks or any bad memory access. O The call will cause 2 memory leaks. O The call will cause 5 memory leaks. O The call will cause 6 memory leaks.

Step by Step Solution

3.44 Rating (147 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The call will cause 5 memory leaks Explanation In line 1 memory is allocated for curr u... View full answer

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 Programming Questions!