顺序栈

头文件

 1 //@ author 成鹏致远
 2 //@ net http://infodown.tap.cn
 3 //@ qq 552158509
 4 //@ blog lcw.cnblogs.com
 5 
 6 //顺序栈
 7 
 8 #ifndef __SQSTACK_H
 9 #define __SQSTACK_H
10 
11 
12 #include <stdio.h>
13 #include <stdlib.h>
14 #include <stdbool.h>
15 
16 #define MAXSIZE 1024
17 
18 typedef int datatype;
19 
20 typedef struct stack
21 {
22     datatype data[MAXSIZE];
23     int top;//指向栈顶
24 }sqstack,*p_sqstack;
25 
26 extern void sqstack_init(p_sqstack *pstack);//栈的初始化
27 extern bool is_empty(p_sqstack pstack);
28 extern bool is_full(p_sqstack pstack);
29 extern bool sqstack_push(p_sqstack pstack, datatype data);//压栈操作
30 extern bool sqstack_pop(p_sqstack pstack, datatype *result);//出栈操作
31 extern void sqstack_show(p_sqstack pstack);//显示栈元素
32 
33 #endif
View Code

相关文章: