#include <stdio.h> #include <stdlib.h> #define OUTSTACK 2147483647 #define STACKSIZE 100 int *top, *bottom, *max_stack; int push( int item ) { if (top < max_stac) return *top++ = item; else { printf(”Pinon ylivuoto\n”); return OUSTACK; } } int pop( void ) { if (top > bottom) return *--top; else { printf(”Pinon alivuoto\n”); return OUTSTACK; } } int main(void) { int luku, ok; bottom = top = (int *) malloc(STACKSIZE*sizeof(int)); max_stack = bottom + STACKSIZE; while ( scanf(”%d”,&luku)==1 ) { ok = push(luku); if ( ok==OUTSTACK ) break; } while (top > bottom) printf(”%d \n”, pop()); return 0; }