顺序队列

头文件

 1 //@ author 成鹏致远
 2 //@ net http://infodown.tap.cn
 3 //@ qq 552158509
 4 //@ blog lcw.cnblogs.com
 5 
 6 #ifndef __SQUEUE_H
 7 #define __SQUEUE_H
 8 
 9 #include <stdio.h>
10 #include <stdlib.h>
11 #include <stdbool.h>
12 
13 #define MAXSIZE 1024
14 
15 typedef int datatype;
16 
17 typedef struct node
18 {
19     datatype data[MAXSIZE];
20     int front,rear;
21 }squeue,*p_squeue;
22 
23 extern void squeue_init(p_squeue *pqueue);//初始化队列
24 extern bool is_empty(p_squeue pqueue);//为了区别队满和队空,队列浪费一个空间
25 extern bool is_full(p_squeue pqueue);
26 extern bool in_squeue(p_squeue pqueue, datatype data);//入队操作
27 extern bool out_squeue(p_squeue pqueue, datatype *result);//出队操作
28 extern void squeue_show(p_squeue pqueue);//显示队列
29 
30 #endif
View Code

相关文章: