Question: The following C function takes a singly linked list as an input argument. It modifies the list by moving the last element to the front
The following C function takes a singly linked list as an input argument. It modifies the list by moving the last element to the front of the list and returns the modified list. Some part of the code is left blank.


Choose the correct alternative to replace the blank line
A. q = NULL; p->next = head; head = p;
B. q->next = NULL; head = p; p->next = head;
C. head = p; p->next = q; q->next = NULL;
D. q->next = NULL; p->next = head; head = p
typedef struct node { int value; struct node *next; } Node; Node *move_to_front (Node *head) { Node *p, "q; if ( (head = = NULL || (head->next = = NULL)) return head;
Step by Step Solution
3.52 Rating (159 Votes )
There are 3 Steps involved in it
D 1 Explanation 1 Argument passed to the function movetofron... View full answer
Get step-by-step solutions from verified subject matter experts
