Professional Documents
Culture Documents
Program No - 9 Roll No - 2309030 / Write A Program To Implement Queue Using Pointers
Program No - 9 Roll No - 2309030 / Write A Program To Implement Queue Using Pointers
#include <stdio.h>
#include <conio.h>
#include<stdlib.h>
#include<malloc.h>
int a,n;
void insert(int);
int delete();
struct node
{
int info;
struct node*next;
};
typedef struct node node;
node*f =NULL,node*r=NULL;
void main()
{
int c;
clrscr();
printf("1:insert \n");
printf("2:delete \n");
printf("3:exit \n");
while(1)
{
printf("enter the c");
scanf("%d",&c);
switch(c)
{
case 1:
printf("enter the num to be insert");
scanf("%d",&n);
push(n);
break;
case 2:n=pop();
if(n!=-1)
printf("\nelement deleted:%d",n);
else
printf("\nqueue is empty");
break;
case 3:exit(0);
default:printf("wrong choice");
break;
}
}
}
1
PROGRAM NO-->9 ROLL NO->2309030
2
PROGRAM NO-->9 ROLL NO->2309030
/*OUTPUT*\