#include<stdio.h> #include<stdlib.h> #define MAX_SIZE 100 typedef struct sqstack { int data[MAX_SIZE]; int top; }sqstack,*linkstack; linkstack initstack() { linkstack s; s=(linkstack)malloc(sizeof(sqstack)); if(!s) exit(1); else { s->top=-1; return s; } } int push(linkstack s,int x) { if(s->top==MAX_SIZE-1) return 0; else { s->top++; s->data[s->top]=x; return 1; } } int pop(linkstack s,int *x) { if(s->top==-1) return 0; else { *x=s->data[s->top]; s->top--; return 1; } } int main(void) { int i,x,count=0; int t=0; linkstack stack; stack=initstack(); while(scanf("%d",&x)!=EOF) { push(stack,x); count++; } for(i=0;i<count;i++) { pop(stack,&t); printf("%-5d",t); } printf("/n"); return 0; }