顺序栈类型定义如下
typedef struct{
SElemType base[10] ;
SElemType * top ;//栈顶指针
int stacksize ;
}Stack;
有如下程序:
void main( ) {
Stack S ;
char x , y ;
InitStack ( S ) ; (1)
x=’c’ ; y = ‘k’ ;
Push ( S , x ) ; Push ( S , ‘o’ ) ; Push ( S , y ) ; (2)
Pop (S , x ) ; Push (S , ‘m’ ) ; Push ( S , x ) ;
Pop (S , x ) ; Push ( S , ‘s’ ) ; (3)
while ( ! StackEmpty (S) )
{ Pop (S , y ) ; printf ( y ) ; } (4)
printf (x) ;
}
请写出程序执行到标号后栈的状态,并写出运行结果。
