Ex 5
Ex 5
91900133035
DSA
#include<stdio.h>
#include<malloc.h>
struct Process
int processNo;
int priority;
};
//Declaration of Functions
void displayMenu();
void Dequeue();
void printQueue();
int main()
int op,val;
do
displayMenu();
printf("\n Select Operation : ");
scanf("%d",&op);
switch(op)
case 1:
Enqueue();
break;
case 2:
Dequeue();
break;
case 3:
printQueue();
break;
}while(op!=4);
return 0;
void displayMenu()
printf("\n=======================");
printf("\n=======================");
printf("\n 1 - Enqueue");
printf("\n=======================");
void Enqueue()
{
scanf("%d",&(temp->processNo));
scanf("%d",&(temp->priority));
temp->next=NULL;
if(start==NULL)
start=temp;
else
temp->next=start;
start = temp;
else
head=start;
head=head->next;
temp->next=head->next;
head->next=temp;
void Dequeue()
if(start==NULL)
printf("Queue is Empty");
else
temp=start;
start = start->next;
free(temp);
void printQueue()
if(start==NULL)
else
head = start;
while(head!=NULL)
head = head->next;
}