数据结构
```c
#include <stdio.h>
#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
#define MAX_NUM 6
typedef struct{
int queue[MAX_NUM];
int front;
int rear;
int s;
}Queue_Type;
Queue_Type *p;
void InitQueue(Queue_Type *p)
{
p->front = 0;
p->rear = 0;
p->s =0;
}
void OutQueue(Queue_Type *p,int m)
{
int i,y;
for(i=1;i<6;i++)
{
printf("%d",p->front);
p->front = p->front % m + 1;
y=p->queue[p->front - 1];
if(p->front == p->rear)
p->s==0;
}
}
void InQueue(Queue_Type *p,int m)
{
int x;
if((p->s==1)&&(p->rear == p->front))
printf("overflow!\n");
else{
scanf("%d",p->queue[p->rear]);
p->rear +=1;
if(p->rear == m+1)
p->rear = 1;
p->queue[p->rear - 1]=x;
p->s=1;
}
OutQueue(p,6);
}
int main() {
printf("请输入五组数据:\n");
InitQueue(p);
InQueue(p,6);
return 0;
}
###### 运行结果及报错内容
不能输入,直接运行结束