#include <stdio.h>
#include <stdlib.h>
#include<stdbool.h>
#define MaxSize 50
typedef int ElemType;
typedef struct SqQueue
{
ElemType data[MaxSize];
int front;//定义头指针
int rear; //定义尾指针
} SqQueue;
//初始化队列
bool InitQueue(SqQueue *q)
{
q->front=0;
q->rear=0; //头尾指向0号位置
return true;
}
//清空队列
bool ClearQueue(SqQueue *q)
{
q->front=q->rear=0;
return true;
}
//判断队列是否为空,初始状态时,队列全部移走后,头和尾指针这两种状态在一起
bool QueueEmpty(SqQueue
循环队列基本操作代码(C语言)
于 2022-05-16 16:46:54 首次发布