#include <stdio.h>
#include <stdlib.h>
#define MAXSIZE 10
typedef struct {
int data[MAXSIZE];
int top;
}SqStack;
int InitStack(SqStack* node) {
node->top = -1;
return 1;
}
int jugdeStack(SqStack* node) {
if (node->top == -1)
return 1;
else
return 0;
}
int inStack(SqStack *node,int data) {
if (node->top==MAXSIZE-1)
return -1;
node->top++;
node->data[node->top] = data;
return 1;
}
int outStack(SqStack* node,int popData) {
if (node->top == -1)
return -1;
popData = node->data[node->top];
node->top--;
return 1;
}
void printfAll(SqStack* node) {
for (int i = 0; i <= node->top; i++) {
printf("%d\n", node->data[i]);
}
system("pause");
}
int getTop(SqStack* node,int data) {
if (node->top == -1)
return -1;
data = node->data[node->top];
return 1;
}
int main() {
SqStack test;
InitStack(&test);
for (int i = 0; i < MAXSIZE; i++) {
inStack(&test, i);
}
printfAll(&test);
return 0;
}