wats d problem in my display()
#include<iostream> #include<malloc.h> #include <string.h> using namespace std; struct node { char *name; struct node *next; }; typedef struct node Node; void createList(Node **head ) { char str[20]; char *p; cout<<"Enter a String: " ; gets (str) ; p = str; if((strlen(p))<2) return; Node *temp=*head; Node *newnode=(Node*)malloc(sizeof(Node)); newnode->name=p; newnode->next=NULL; if(!temp) *head = newnode; else { while(temp->next) temp = temp->next; temp->next = newnode; } createList(head); } void display(Node *head) { cout<<"\n"; for( ; head ; head=head->next) cout<<"\t"<<head->name; cout<<"\n"; } int main() { Node *head=NULL; while(1) { cout<<"\n\t\tMENU\n"; cout<<"0 : To exit.\n"; cout<<"1 : To create a linear link list.\n"; cout<<"2 : To display the list.\n"; char choice; choice = getchar(); getchar(); if(choice=='0') break; switch(choice) { case '1': createList(&head ); break; case '2': display(head); break; default: cout<<"Enter valid choice."; } } system("pause"); return 0; } -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.