棧(stack) LIFO last in first out?
隊列(queue) FIFO first in first out
只有隊尾指針的隊列
int rear=-1;if(rear==MAX-1){printf("上溢");return;}rear++;data[rear]=x;}
有隊頭和隊尾的隊列
int front=-1,rear=-1;if(rear==MAX-1){printf("上溢");return;}rear++;data[rear]=x;}
循環(huán)隊列
int front=-1,rear=-1;if((rear+1)%MAX==front){printf("上溢");return;}rear=(rear+1)%MAX//rear++;data[rear]=x;}