Program for QUEUE Data Structure has been done , below is the program for
***************Prototype****************
int mainmenu(); typedef struct staack { int fp; int rp; int size; int *stkptr; }queue; queue* creatqueue(); int enqueue(queue*); int dequeue(queue*); int display(queue*);
****************Createqueue*************
#include"headers.h" #include"prototype.h"
queue* creatqueue() { queue *start; start = (queue*)malloc(sizeof(queue)); printf("enter the size of queue\n");
{ if(start->rp==start->size-1) { puts("stack is full now\n"); return 0; } start->rp++;
if(start->fp>=0) { if(start->rp==start->fp) { puts("stack is full now\n"); return 0; } } if(start->fp>=0) { start->rp=0; } puts("enter value in the queue\n"); scanf("%d",(start->stkptr+start->rp));
}
****************Dequeue****************
#include"headers.h" #include"prototype.h"
int dequeue(queue *start) { if(start->rp==-1) { puts("stack is empty now\n"); return 0; } start->fp++;