0% found this document useful (0 votes)
1 views2 pages

Rudspract 21

The document contains a C program that implements INSERT and DELETE operations on a linear queue using an array. It defines a maximum size for the queue and provides a menu for user interaction to enqueue, dequeue, display, or exit. The program includes error handling for underflow and overflow conditions.

Uploaded by

ranimande0
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views2 pages

Rudspract 21

The document contains a C program that implements INSERT and DELETE operations on a linear queue using an array. It defines a maximum size for the queue and provides a menu for user interaction to enqueue, dequeue, display, or exit. The program includes error handling for underflow and overflow conditions.

Uploaded by

ranimande0
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Name:Manisha Datta Gaikwad }

Branch:CO3K Roll No:26 queue[rear]=item;

Practical Name: Write a c program to perform printf("item inserted !! \n");

INSERT and DELETE operations on Linear queue using an array. }

break;

#include<stdio.h> case 2:

#define MAX_SIZE 3 if(front == -1){

int queue[MAX_SIZE]; printf("underflow & exit !! \


n");
int front = -1,rear = -1;

int main(){
}else{
int item,choice;
item= queue[front];
printf("1.Enque\n 2.deque\n 3.display\n 4.exit\n");
if(front == rear){
while(1){
front = rear -1;
printf("enter your choice");
}else{
scanf("%d",&choice);
front++;

}
switch (choice){
printf("item deleted \n");
case 1:
}
if(rear == MAX_SIZE-1){
break;
printf("overflow & exit !!\n");
case 3:
}else{
if(front == -1){
printf("enter the elements");
printf("queue is empty\n");
scanf("%d",&item);
}else {
if(front == -1){
printf("queue elements\n");
front = rear =0;
for(int i=front;i<=rear;i++)

{
}else{
printf("%d",queue[i]);
rear++;
}

printf("\n");

break;

case 4:

printf("Exit \n");

return 0;

default:

printf("invalid choice\n");

return 0;

You might also like