**假溢出:**数组未满但是越界了。
使用顺序结构写队列,可能回出现下标越界得情况,所以我们可以用循环队列
//循环队列
#define MAXSIZE 100
typedef struct
{
ElemType *base;
int front;
int rear;
}cycleQueue;
//初始化循环队列
//1.分配内存。2.首尾指针指向0
InitQueue(cycleQueue *q)
{
q->base = (ElemType *)malloc(MAXSIZE * sizeof(ELemType));
if(!p->base)
exit(0);
p->front = q->rear = 0;
}
//入队列
InsertQueue(cycleQueue *q, ElemType e)
{
if((q->rear + 1) % MAXSIZE == q->front)
return ;
q->base[q->rear] = e;
q->rear = (q->rear + 1) % MAXSIZE;
}
//出队列
DeleteQueue(cycleQueue *q, Elemtype *e)
{
if(q->front == q->rear)
return ;
*e = q->base[q->front];
q->front = ( q->frpnt + 1) % MAXSIZE;
}