#include <stdio.h>
 
#define M 100
 
typedef struct{
  
    int array[M];
    int current;
}STACK;
 
void init(STACK*);
int push(STACK*,int);
int pop(STACK*,int*);
 
void main(){
    STACK data;
    int value;
    //init(&data);   
    //push(&data,1); 
    //push(&s,2);
    //push(&s,3);
    
    while(pop(&s,&value)){
        printf("%d ",value);
    }
    printf("¥n");
}
 

void init(STACK* pStack)
{
    int i;
    for(i = 0; i < MAX_LENGTH; i++){
        pStack->array[i] = 0;
    }
  
    pStack->current = 0;
}
int push(STACK* pStack,int value)
{
    if(pStack->current < MAX_LENGTH){
        
        pStack->array[pStack->current] = value;
        pStack->current++;
        return 1;
    }
    
    return 0;
}

int pop(STACK* pStack,int* pValue)
{
    if(pStack->current > 0){
        pStack->current--;
        *pValue = pStack->array[pStack->current];
        return 1;
    }
    return 0;
}
