Question: Write a program to reverse a linked-list.

Solution: void recursiveReverse(struct node** head_ref)
{
struct node* first;
struct node* rest;


if (*head_ref == NULL)
return;


first = *head_ref;
rest = first->next;

/* List has only one node */
if (rest == NULL)
return;

/* put the first element on the end of the list */
recursiveReverse(&rest);
first->next->next = first;


first->next = NULL;


*head_ref = rest;
}