#include #include #include struct stud { int roll; char name[20]; char address[30]; stud *next; }; void main() { stud *first, *last, *x; int i,n; cout << "Enter the size of the list "; cin >> n; if( n <= 0 ) cout << "Invalid size entered"; first = new stud; cout << "Enter data of first node:(Name , Roll No, Address) \n"; cin >> first->name >> first->roll ; gets(first->address); first->next = NULL; last = first; for(i=0; i<(n - 1); i++) { x = new stud; cout << "Enter data of Node " << (i+2) << " \n"; cin >> x->name ; cin >> x->roll ; gets(x->address) ; x->next = NULL; last->next = x; last = x; } stud *temp; temp = new stud; // TRAVERSAL OF LINKED LIST temp = first; cout << "The entered list is: \n"; while(temp != NULL) { cout << temp->name << "\t " << temp->roll << "\t" << temp->address << "\n" ; temp = temp->next ; } getch(); }