Featured Post

Step Wise Project Planning

Planning is the most difficult process in project management. The framework described is called the Stepwise method to help to distinguis...

  1. Home

Write a program of array implementation of a queue.

Write a program of array implementation of a queue.

#include<stdio.h>
#include<conio.h>
int rear,front;
int item[10];
void add(int q)
{
int p;
if(rear>10)
{
printf("\noverflow");
}
else
{
rear++;
item[rear]=p;
}
}
void del()
{
int q;
if(rear==front)
{
printf("\nqueue is empty");
}
else
{
front++;
q=item[front];
printf("\nthe deleted value is %d",q);
}
return;
}
void main()
{
clrscr();
int a,b;
int p,q;
front=rear=-1;
for(a=0;a<10;a++)
{
printf("\nenter no.");
scanf("%d",&q);
add(q);
}
for(b=0;b<10;b++)
{
del();
}
getch();
}


Output


Previous
Next Post »