设栈的顺序存储空间为S(0:49),栈底指针bottom=49,栈顶指针top=30(指向栈顶元素)。则栈中的元素个数为( )。

admin2015-07-25  51

问题 设栈的顺序存储空间为S(0:49),栈底指针bottom=49,栈顶指针top=30(指向栈顶元素)。则栈中的元素个数为( )。

选项 A、30
B、29
C、20
D、19

答案C

解析 栈底指针bottom=49,栈顶指针top=30,则栈中的元素个数为49-30+1=20个,答案选C
转载请注明原文地址:https://kaotiyun.com/show/iCID777K
0

相关试题推荐
最新回复(0)