#include <iostream> #include<conio.

h> using namespace std; struct node { int d; node*next; }; void display(node*first) { node*c=first; while(c) { cout <<c->d<<' '; c=c->next; } cout<<endl; } void reverse(node*c,node*prev=0) { if(c->next)reverse(c->next,c); c->next=prev; }

} . node*n2=n1->next=new node. n1->d=1. node*n3=n2->next=new node.int main() { node*n1=new node. n3->d=3. delete n3. delete n5. delete n2. getch(). n5->next=0. reverse(n1). return 0. n2->d=2. node*n4=n3->next=new node. n4->d=4. delete n1. display(n1). display(n5). n5->d=5. node*n5=n4->next=new node. delete n4.

Sign up to vote on this title
UsefulNot useful