#include <stdio.h>
#define STACK_SIZE 12
int stack[STACK_SIZE];
int top = 0;
int is_full()
{
return top == STACK_SIZE;
}
void push(int data) //压栈
{
if (!is_full())
{
stack[top++] = data;
}
}
int is_empty()
{
return top == 0;
}
int pop()//出栈
{
if (!is_empty())
{
return stack[–top];
}
}
int main()
{
int i;
for (i = 0; i < 10; i++)
{
push(i + 1);
}
while (!is_empty())
{
printf("%d ", pop());
}
printf("\n");
return 0;
}