The following C function takes a singly linked list as an input argument. It modifies the list

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 of the list and returns the modified list. Some part of the code is left blank.

image text in transcribed

image text in transcribed

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

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: