PRIORITY QUEUE PRINTOUT

PRIORITY QUEUE PRINTOUT - #include...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
#include<stdio.h> #include<conio.h> #define max 10 /*RISHI AGARWAL PRIORITY QUEUE   ROLL NO 02   SE CMPN A */ struct process {  int pri;  char disc[30]; }; struct priqueue {  int arr[max];  int front;  int rear;  struct process z[max]; }; int del(struct priqueue *s) {  int d;  if((s->front==-1))  {   printf("Array is empty");   return NULL;  }  d=s->arr[s->front];  if(s->front==s->rear)  {   s->front=-1;   s->rear=-1;  }  else  { (s->front)++; }  return d; } void display(struct priqueue *s) {  int i=0;   if((s->front==-1))  {   printf("Array is empty");   return;
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
 }    printf("Data Priority Disc \n");  for(i=s->front;i<=s->rear;i++)  {printf("%-4d %-8d %s \n",s->arr[i],s->z[i].pri,s->z[i].disc);} } void insert(struct priqueue *s,int v,struct process r) {  int i,j,t;  if(s->rear==max-1)  {   printf("Array is full");   return;  }  if(r.pri<1||r.pri>10)  {   printf("Invalid Priority\n");
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/25/2010 for the course CMPN SEM3 taught by Professor Thakur during the Fall '07 term at University of Mumbai.

Page1 / 5

PRIORITY QUEUE PRINTOUT - #include...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online