The list is : 1 2 3 null
and it's exact opposite : 3 2 1 null
Here's what I have tried but I am stucked in the middle.Someone please help me.
#include<stdio.h>
#include<stdlib.h>
typedef struct list{
int data;
struct list*next;
} LIST;
void add_list(int x,LIST *y)
{
LIST *c = (LIST *)malloc(sizeof(LIST));
c->data = x;
c->next = y->next;
y->next=c;
}
LIST* reverse_recurse(LIST* p,LIST* head)
{
if(p->next==NULL)
{
head->next=p;
return p;
}
else
{
reverse_recurse(p->next,head)->next=p;
}
return p;
}
int main(void)
{
LIST* head;
head=(LIST *)malloc(sizeof(LIST));
int i=1;
for(i=3;i>=1;i--)
*/have no idea how to do the rest.../


Sign In
Create Account


Back to top









