during recursion a stack is created what does that stack contains, does it contains the values or it stores the addresses of the operands
void recursiveReverse(struct node** head_ref)
{
struct node* first;
struct node* rest;
/* empty list */
if (*head_ref == NULL)
return;
/* suppose first = {1, 2, 3}, rest = {2, 3} */
first = *head_ref;
rest = first->next;
/* List has only one node */
if (rest == NULL)
return;
/* reverse the rest list and put the first element at the end */
recursiveReverse(&rest);
first->next->next = first;
/* tricky step -- see the diagram */
first->next = NULL;
/* fix the head pointer */
*head_ref = rest;
}
in above code the rest pointer maintains the address of the last node while the first pointer keeps on changing ,i.e it is taking values from the stack while rest pointer not . so first i want to know about recursive stack , it's structure, what it contains, how it works and the explanation of the above code is appreciated