typedef int Status; typedef int ElemType;

#define MaxQSize 10

typedef struct { ElemType *base; int front; int rear; Status flag; } Queue;

Status EnQueue(Queue &q, ElemType e) { if (q.front == q.rear && q.flag == 1) { // 队列满 return 0; } q.base[q.rear] = e; q.rear = (q.rear + 1) % MaxQSize; q.flag = 1; return 1; }

C语言实现循环队列入队操作:判断队列满

原文地址: https://www.cveoy.top/t/topic/nIJz 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录