Question: (C PROGRAMMING) This is all the question gives so assume that pList has been initialized and created correctly, the NODE structure has been defined similar
(C PROGRAMMING)
This is all the question gives so assume that pList has been initialized and created correctly, the NODE structure has been defined similar
to the format of
typedef struct node
{
int data; //pList
struct node *next; //link
} NODE;
Please try to explain what each one attempts is trying to do also why it fails/succeeds.

C. What is the output? What would happen if we call the following function? printf(" %d ", func(pList)); // pList: 20 40 50 10 int func( NODE *pList ) { NODE *p1; NODE *p2; p2 = NULL; p1 = pList; while (p1->link) { p2 = p1; p1 = p1->link; p1->link = pList; printf(" %d ", p1->link->link->data); return p2->data; } } D. What is the output? What would happen if we call the following function? printf(" %d ", funD (pList)); // pList: 20 40 50 10 int fund( NODE *pList) { NODE **ptr; ptr = &pList; while (*ptr) { ptr = &((*ptr)->link); } *ptr = pList; printf(" %d ", (*ptr)->link->data); return (*ptr)->data; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
