Here is some code that operates on a singly linked list. Say P is pointer to a linked list. Linked list node has value and next elements.
Q=P->next;
P->next=NULL;
while (!Q)
{
S = Q;
Q=Q->next;
S->next = P;
P=S;
}
at the end of the code what is the value of P. what is the end result.