Could someone please help me with this program..why wont it compile......
#include <stdio.h>
#include <stdlib.h>
//#include "stdafx.h"
#define MAXQUEUE 3
typedef char QueueEntry;
typedef struct queue{
int count;
int front;
int rear;
QueueEntry entry[MAXQUEUE];
}Queue;
void TraverseQueue(Queue *, QueueEntry*);
void Append(QueueEntry, Queue *);
void Serve(QueueEntry *, Queue *);
void CreateQueue(Queue *);
int QueueFull(Queue *);
int QueueEmpty(Queue *);
int main()
{
return 0;
}
//Create the queue
void CreateQueue(Queue *q)
{
q -> count = 0;
q -> front = 0;
q -> rear = 0;
}
//Append an entry to the queue
void Append(QueueEntry x, Queue *q)
{
if(QueueFull(q))
{
printf("Cannot append an entry to a full queue.");
}
else
{
q -> count ++;
q -> rear = (q->rear + 1) %MAXQUEUE;
q -> entry [q->rear] = x;
}
}
void TraverseQueue(Queue *q, void (*visit) (QueueEntry))
{
int position;
if(! QueueEmpty(q))
{
if (q ->front <= q-> rear)
{
for(position = q -> front; position == q -> rear; position ++);
visit (q -> entry [position]);
}
else
{
for(position = q -> front; position == MAXQUEUE; position ++);
visit ( q -> entry [position]);
}
for (position = 1; position == q -> rear; position ++)
visit(q -> entry [position]);
}
}
int QueueFull(Queue *q)
{
return q->count>=MAXQUEUE;
}
int QueueEmpty(Queue *q)
{
return q -> count <= 0;
}