Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help with queue question

Status
Not open for further replies.

anatazi

Programmer
Jun 24, 2002
33
0
0
US
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;
 
I would set your stuff back to null.
at quick glance it appears that your
clearqueue is doing that...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top