Exemple #1
0
int Pop_Queue(SeQueue *q)
{
  if (Empty_Queue(q))
    return 0;
  q->num--;
  q->front = (q->front + 1) % MAXSIZE;
  return 1;
}
Exemple #2
0
void EnQueue(char a, Queue *Q)
{
  if(!Full_Queue(*Q))
    {
      if(Empty_Queue(*Q)) 
	Q->Front = 0;
      Q->Rear = Q->Rear + 1;
      Q->elements[Q->Rear] = a;
    }
  else printf("Queue is full!\n");
}
Exemple #3
0
void DeQueue(char *a, Queue *Q)
{
  if(!Empty_Queue(*Q))
    {
      *a = Q->elements[Q->Front];
      Q->Front = Q->Front+1;
      if(Q->Front > Q->Rear)
	{
	  MakeNull_Queue(Q);
	}
    }
  else 
    printf("Queue is empty!\n");
}
Exemple #4
0
datatype Top_Queue(SeQueue *q)
{
  if (Empty_Queue(q))
    return 0;
  return q->data[q->front];
}