Hi all,
How do you clear a queue that is implemented in an array?
here is my tentative code below. Please give me some feedback. Thanks
void clearqueue (queueentry *x, queue *q)
{
while(q->front)
{
q->count--;
x*=q->entry[q->front];
q->front=(q->front + 1) % MAXQUEUE;
}
q->front = NULL;
q->rear = NULL;
}
here is the structure declaration :
typedef struct queue{
int count;
int front;
int rear;
queueentry entry[MAXQUEUE];
}Queue;
How do you clear a queue that is implemented in an array?
here is my tentative code below. Please give me some feedback. Thanks
void clearqueue (queueentry *x, queue *q)
{
while(q->front)
{
q->count--;
x*=q->entry[q->front];
q->front=(q->front + 1) % MAXQUEUE;
}
q->front = NULL;
q->rear = NULL;
}
here is the structure declaration :
typedef struct queue{
int count;
int front;
int rear;
queueentry entry[MAXQUEUE];
}Queue;