| |
| q->front=q->rear = 0; |
| |
| q.count == 0; |
| |
| |
| q.count == M; |
| |
| |
| datatype get_queue (cirqueue q) |
| { |
| if(q.count == 0 ){ |
| printf ( “queue null “ ) ; |
| exit (0) ; |
| } |
| return ( q.data [q.front]); |
| } |
| |
| |
| void enqueue(cirqueue * q, datatype x ){ |
| |
| if (q->count = = M) { printf(“over flow “) ; exit(0);} |
| |
| q->data[q->rear ] = x ; |
| q->rear = (q->rear+1)% M ; |
| q->count ++ ; |
| } |
| |
| |
| datatype dequeue(cirqueue * q , datatype x ){ |
| |
| if(q->count == 0 ) {printf (“queue null”) ; exit(0); } |
| |
| x=q->data[q ->font]; |
| q->front = (q->front + 1)%M ; |
| q->count-- ; |
| return (x) ; |
| } |