CIRCULAR QUEUE PRINTOUT

CIRCULAR QUEUE PRINTOUT - #include<stdio.h>...

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

View Full Document Right Arrow Icon
Sheet1 Page 1 #include<stdio.h> #include<conio.h> #define max 10 /*RISHI AGARWALCIRCULAR QUEUE ROLL NO 02 SE CMPN A */ struct cqueue { int arr[max] int front int rear } void insert(struct cqueue *s,int v) { { printf("Array is full\n") return } if(s->rear==max-1) { s->rear=-1 } (s->rear)++ s->arr[s->rear]=v if(s->front==-1) {s->front=0 } } int del(struct cqueue *s) { int d if((s->front==-1)) { printf("Array is empty\n") return NULL } d=s->arr[s->front] if(s->front==s->rear) { s->front=-1 s->rear=-1 } else { if(s->front==max-1) s->front=0 else
Background image of page 1

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

View Full DocumentRight Arrow Icon
Sheet1 Page 2 (s->front)++ } return d } void display(struct cqueue *s) { int z=s->front if((s->front==-1)) { printf("Array is empty\n") return } printf("Data:\n") while(z<=s->rear) { printf("%d) %d\n",z,s->arr[z]) z++ } if(s->rear<s->front) { while(z<max) { printf("%d) %d\n",z,s->arr[z]) z++ } z=0 while(z<=s->rear) { printf("%d) %d\n",z,s->arr[z]) z++ } } } void main() { struct cqueue p int x,d,a
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.

Page1 / 3

CIRCULAR QUEUE PRINTOUT - #include&lt;stdio.h&gt;...

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