顺序栈的类型定义如下:typedef struct{DataType data[MaxSize];int top;}SeqSta

顺序栈的类型定义如下:
typedef struct{
DataType data[MaxSize];
int top;
}SeqStack;
SeqStack S;
规定栈底位置在数组下标为0的一端,请回答下列问题。
(1)用语句表示判断栈非空的条件。
(2)用语句表示连续k(k为正整数)次出栈的操作。
【正确答案】:(1)top≥0或top!=-1
(2)int count=0;while(!StackEmpty(S)&&count<k){top--;count++;}
或int count=0;while(count<k){Pop(&S);count++;}