-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstack.h
More file actions
36 lines (32 loc) · 770 Bytes
/
stack.h
File metadata and controls
36 lines (32 loc) · 770 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//the coding is UTF-8
#ifndef _STACK_H_
#define _STACK_H_
#include <stdio.h>
#include <stdlib.h>
#include "tree.h"
#define INITSIZE 100 //储存空间的初始分配量
typedef struct
{
int cmd; //要撤销的命令
tree data; //要撤销的对象
tree data2; //备用
char *str; //备用
student stu; //备用
} unit;
typedef unit ElemType;
typedef struct
{
ElemType *base; //存放元素的动态数组空间
int top; //栈顶指针
int stacksize; //当前栈空间的大小
} stack;
void InitStack(stack *S);
int StackLength(stack *S);
ElemType *gettop(stack *S);
int push(stack *S, ElemType x);
int pop(stack *S);
int StackEmpty(stack *S);
void list(stack *S);
void Clear(stack *S);
void Destroy(stack *S);
#endif