/*****
Reversing content of linked list using Recursion
ReverseusingRecursion() is a function which returns a pointer to a structure
and it takes NULL in prev node and head in curr.
*****/
void ReverseusingRecursion(struct node *,struct node *); // Global Declaration of function
ReverseusingRecursion(NULL,head); // Calling ReverseusingRecursion() function from main()
void ReverseusingRecursion(struct node *prev, struct node *curr)
{
if(curr)
{
ReverseusingRecursion(curr,curr->link);
curr->link=prev;
}
else
head=prev;
}
Reversing content of linked list using Recursion
ReverseusingRecursion() is a function which returns a pointer to a structure
and it takes NULL in prev node and head in curr.
*****/
void ReverseusingRecursion(struct node *,struct node *); // Global Declaration of function
ReverseusingRecursion(NULL,head); // Calling ReverseusingRecursion() function from main()
void ReverseusingRecursion(struct node *prev, struct node *curr)
{
if(curr)
{
ReverseusingRecursion(curr,curr->link);
curr->link=prev;
}
else
head=prev;
}