C++ 面向过程栈的实现 发表于 2013-03-26 更新于 2022-11-07 分类于 C/C++ 栈,先进后出,后进先出。 #include using namespace std; #define STACK_SIZE 5 struct Stack { int top; int buffer[STACK_SIZE]; }; void init(Stack &s) { s.top=-1; } bool push(Stack &s,int i) { if(s.top