How to understand head->next->next = head; for reverse single list by Recursion?
<p>A signle link list, i want revese it by recursion. but i don't understand the meaning of this line <code>head-&gt;next-&gt;next = head;</code>.</p>

<p>why there need <code>head-&gt;next-&gt;next</code>?</p>

<pre><code>struct Node{
    int data;
    Node* next;
};
</code></pre>

<p>Here is the implement code:</p>

<pre><code>Node* reverseByRecursion(Node *head)
{

    if(head == NULL || head-&gt;next == NULL) 
        return head;

    Node *newHead = reverseByRecursion(head-&gt;next);

    head-&gt;next-&gt;next = head;
    head-&gt;next = NULL;

    return newHead;    
}
</code></pre>