头文件SeqStack.h
其中使用结构体对栈进行定义,声明了所使用的函数,并使用 #ifndef 防止重复定义
#ifndef _SEQSTACK_H_
#define _SEQSTACK_H_
#include <stdio.h>
#include <stdlib.h>
typedef int SSDataType;
typedef struct SeqStack
{
SSDataType *data;
int maxlen;
int top;
} SS;
SS *SSInit(int len);
int SSPush(SS *PS, SSDataType data);
int SSPop(SS *PS);
int SSLength(SS *PS);
int SSGetTop(SS *PS);
void SSClear(SS *PS);
#endif
SeqStack.c文件
函数定义
SS *SSInit(int len); | 栈的初始化函数 |
int SSPush(SS *PS, SSDataType data); | 入栈函数 |