typedef struct Node *PtrToNode;
struct Node {/ * Node queue * / ElementType Data; PtrToNode Next;};
typedef PtrToNode Position; struct QNode
{Position Front, Rear; / * head of the queue, the tail pointer * /
int MaxSize; / * maximum capacity of the queue * /};
typedef struct QNode *Queue; bool IsEmpty( Queue Q )
{ return ( Q->Front == NULL); } ElementType DeleteQ( Queue Q )
{ Position FrontCell; ElementType FrontElem; if ( IsEmpty(Q) )
{Printf ( "queue empty");
return ERROR; }
else { FrontCell = Q->Front;
if (Q-> Front == Q-> Rear) / * if there is only one queue element * /
Q-> Front = Q-> Rear = NULL; / * set delete queue empty * /
else
Q->Front = Q->Front->Next;
FrontElem = FrontCell-> Data; free (FrontCell); / * release the node is removed space * /
return FrontElem; } }