i want to print my list in the reverse..ie..the last item first and first one last..
i am new to this ..i have created the list and printed it but couldnt do that in reverse order ..please help
Code:#include<alloc.h> #define NULL 0 struct linked_list { int number; struct linked_list *next; }; typedef linked_list node; void main() { void create(node *); void print(node *); clrscr(); node *head; head=(node*)malloc(sizeof(node)); create(head); print(head); getch(); } void create(node *p) { printf("Enter the number : \n"); scanf("%d",&p->number); if(p->number==999) { p->next=NULL; } else { p->next=(node*)malloc(sizeof(node)); create(p->next); } return; } void print(node *p) { if(p->next!=NULL) { printf("%d-->",p->number); print(p->next); } }