1
#include<stdio.h>
#include<stdlib.h>
struct node
int info;
struct node *llink;
struct node*rlink;
};
typedef struct node *NODE;
NODE first=NULL;
NODE insert_begin(NODE first)
NODE temp;
int item;
printf("enter thde value\n");
scanf("%d",&item);
temp=(NODE) malloc(sizeof(NODE));
if(temp==NULL)
printf("out of memory n");
exit(0);
temp->info=item;
temp->rlink=first;
temp->llink=NULL;
if(first!=NULL)
first->llink=temp;
printf("%d is inserted\n",temp->info);
first=temp;
return first;
2
NODE delete_begin(NODE first)
NODE cur;
if(first==NULL)
printf("list is emty\n");
return first;
cur=first;
first=first->rlink;
if(first!=NULL);
first->llink=NULL;
printf("%d is deleted\n",cur->info);
free(cur);
return first;
NODE display(NODE first)
NODE cur;
if(first==NULL)
printf("list is empty\n");
return first;
cur=first;
printf("content of the list are \n");
while(cur!=NULL)
printf("%d\t",cur->info);
cur=cur->rlink;}
3
printf("\n");
return first;
int main()
int option;
do
printf("\n doubly linked list opertion\n");
printf("1:insert\t2:delete\t3:display\t4:exit\n");
printf("enter the option:");
scanf("%d",&option);
switch(option)
case 1:first=insert_begin(first);
break;
case 2:first=delete_begin(first);
break;
case 3:first=display(first);
break;
case 4:break;
}while(option!=4);