Jan
23
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
typedef struct node
{
int n;
struct node *link;
}NODE;
void main()
{
int c;
NODE *temp,*start=NULL,*p;
clrscr();
//temp=(NODE *)malloc(sizeof(NODE));
 while(1)
  {
  printf("\n\t 1. PUSH\n\t 2. POP");
  printf("\n\t 3. DISPLAY\n\t 4. EXIT");
  printf("\n\t ENTER ANY CHOICE\t");
  scanf("%d",&c);
  switch(c)
  {
  case 1: printf("\n\t ENTER ANY NUMBER\t");
  temp=(NODE *)malloc(sizeof(NODE));
  scanf("%d",&temp->n);
  if(start==NULL)
  {
  temp->link=NULL;
  start=temp;
  p=temp;
  }
  else
  {
  temp->link=NULL;
  p->link=temp;
  p=temp;
  }
  break;
  case 2: if(start==NULL)
  printf("\n\tEMPTY LIST");
  else
  printf("\n\t %d IS DELETED",start->n);
  start=start->link;
  break;
  case 3: temp=start;
  while(temp!=NULL)
  {
  printf("\n\t\t%d",temp->n);
  temp=temp->link;
  }
  break;
  case 4:exit(1);
  default:printf("\n\t YOU ENTERED AN INVALID CHOICE");
  printf("\n\nPLEASE TRY AGAIN……….\t");
 }
  }
  getch();
  }
January 23rd, 2013 at 6:17 PM
it is very helpfull sir, I like it, Please post more on linked list..
January 23rd, 2013 at 7:47 PM
Yes arun i will try to give more and more to knowledge seekers through this blog
January 24th, 2013 at 10:39 AM
Sir,
Great post , really liked but it would be far better if it could be elaborated line by line
Thanks
Rajesh
January 24th, 2013 at 2:21 PM
Thanks rajesh, I agree with you opinion.
I have just posted all the sample program, if someone have any clarification he/she can write me and not only me but anyone can explian on this blog.
Thanks again for writing, hope same in future.