Page 105 - DCAP407_DATA_STRUCTURE
P. 105

Data Structure



                                               struct list *next;
                                          }*HEAD,*newnode,*PTR;
                                          void menu();
                                          void createnode();

                                          void display();
                                          int emptylist();
                                          void insert_beg(int);


                                          void main()
                                          {
                                              clrscr();
                                              menu();

                                          }
                                          void menu()
                                          {
                                              int choice, num;
                                              printf("MENU");
                                              printf("\n1. Create node");

                                              printf("\n2. Display");
                                              printf("\n3. Insert node at the beginning");
                                              printf("\n4.Exit");
                                              printf("\n Enter your choice: ");
                                              scanf("%d",&choice);
                                          switch(choice)
                                          {

                                          case 1:
                                             createnode();
                                             clrscr();
                                             printf("The created linked list is:\n");
                                             display();
                                             getch();

                                             clrscr();
                                             menu();
                                             break;
                                          case 2:
                                             clrscr();
                                             if(emptylist()==1)





                          98                      LOVELY PROFESSIONAL UNIVERSITY
   100   101   102   103   104   105   106   107   108   109   110