Hi,

I am trying to reverse a Linked list using recursion but whenever I try to print it after reversal it prints only the last element of the list.

Code:
void reverseRecursive(Node **root, Node *temp)
{
	Node *next = temp->next;
	if(temp->next == NULL)
		{
			*root = temp;
			return;
		}
	reverseRecursive(&(*root), temp->next);
//	printf("%d ", next->data);
	temp->next = temp->prev;
	temp->prev = next;	
}
Could you help me figure where the mistake lies?

I have just posted the reverse function to enable easy readability rather than post the entire code