#include<stdio.h>
#define MAX 10

void push( char c, char* s, int* top )
{
	if( *top == MAX ) {
		printf( "Can not push any more!\n" );
	}
	else {
		s[*top] = c;
		(*top)++;
	}
}
char pop( char* s, int* top )
{
	if( *top == 0 ) {
		printf( "No stack!\n" );
		return 0;
	}
	else {
		(*top)--;
		return s[*top];
	}
}
void print_stack_ary( char *s, int top )
{
	int i;

	for( i = top; i > 0; i-- )
		printf( "%c\n", s[i-1] );
}
int main()
{
 
	char s[MAX];
	int top = 0;
	char c;

	push( 'a', s, &top );
	push( 'b', s, &top );
	push( 'c', s, &top );
	push( 'd', s, &top );
	push( 'e', s, &top );

	print_stack_ary( s, top );
	c = pop( s, &top );
	printf( "poped %c\n", c );
	print_stack_ary( s, top );
    return 0;
}
