Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion Queue/queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ int rear=-1;
int enQueue(int);
int deQueue();
void display();
void peek();

void main(){

Expand All @@ -18,7 +19,7 @@ int choice;
while(1){
printf("\n****************************\n");
printf("Enter the number for operation on queue\n");
printf("1.enqueue\n2.dequeue\n3.display\n");
printf("1.enqueue\n2.dequeue\n3.display\n4.Peek");
scanf("%d",&choice);
switch(choice){

Expand All @@ -34,6 +35,11 @@ case 2:
case 3:
display();
break;

case 4:
peek(); // Peek displays the first element of the queue
break;


default:
printf("Wrong input please try again.\n");
Expand Down Expand Up @@ -69,6 +75,11 @@ printf("%d deleted from queue\n",queue[front]);
front=front+1;
}
}
void peek()
{
printf("The top element of the Stack is : %d",queue[front]);
}


void display(){

Expand Down