typedef struct {DataType data[MaxSize]; int top;} LinearStack;//初始化 void initStack(LinearStack &stack) {stack.top = -1;}void isEmpty(LinearStack stack) {return stack.top == -1;}bool push(LinearStack &stack, DataType x) {if(stack.top + 1 == MaxSize) {return false;}stack.data[++stack.top] = x;return true; }bool pop(LinearStack &stack, DataType &x) {if(stack.top == -1) {return false;}x = stack.data[stack.top--];return true;}bool getTop(LinearStack &stack, DataType &x) {if(stack.top == -1) {return false;}x = stack.data[stack.top];return true;}
1200字范文,内容丰富有趣,写作的好帮手!