#include <stdio.h>
int stack[100]; /*100个栈空间*/
int* sp = stack; /*栈指针指向栈底*/
#define push( i ) { *sp++ = i; } /*push一个数*/
#define pop() (*--sp) /*pop一个数并返回*/
int main()
{
int i;
for ( i = 0; i < 10; ++i )/*push 0~9*/
push( i );
for ( i = 0; i < 10; ++i )/*输出9~0*/
printf( "%d ", pop() ) ;
}
温馨提示:答案为网友推荐,仅供参考