Array Implementation of A Queue AIM
Array Implementation of A Queue AIM
AIM
To write a c program to represent queue using array.
CODING
#include<stdio.h>
#include<conio.h>
#define QSIZE 5
#define FULL 0
#define EMPTY 1
#define SOMEDATA 2
int front,rear,Qstatus;
void main()
{
int queue[QSIZE],choice,data;
clrscr();
Queue underflow!!
enter your choice:1
Queue contains...front-->11-->rear
Queue contains...front-->11-->22-->rear
Queue contains...front-->11-->22-->33-->rear
RESULT
Thus queue has been implemented using arrays.
LINKED LIST IMPLEMENTATION OF A QUEUE
AIM
To write a c program to represent queue using linked list.
CODING
#include<stdio.h>
#include<conio.h>
struct queue
{
int data;
struct queue *nextptr;
};
void main()
{
struct queue *frontptr=NULL,*rearptr=NULL;
int choice,item;
clrscr();
Queue contains...front->22->rear
enter your choice:1
Queue contains...front->22->33->rear
enter your choice:1
Queue contains...front->22->33->44->rear
enter your choice:2
RESULT
Thus queue has been implemented using linked list.