Posts

Showing posts with the label Data structure queue.

Implementing queue datastructure using c program.

/*queue*/ #include<stdio.h> #include<stdlib.h> #define queue_size 5 int c,item,f,r,q[10]; void ri() {     if(r==queue_size-1)     {         printf("queue overflow\n");         return;     }     r=r+1;     q[r]=item; } void fd() {     if(f>r)     {         printf("queue underflow\n");         return;     }     printf("the element deleted is %d",q[(f)++]);     if(f>r)f=0,r=-1; } void display() {     int i;     if(f>r)     {         printf("queue is empty\n");         return;     }     printf("contents of the...