单选题 Java
题号 #2590448

假设用-个长度为50的数组(数组元素的下标从0到49)作为栈的存储空间,栈底指针bottom指向栈底元素,栈顶指针top指向栈顶元素,如果bottom=49,top=30(数组下标),则栈中具有的元素个数为(  )。

进入在线模考

参考答案

B

答案解析

当前栈中的所有元素的个数就是用栈底指针减去栈顶指针。

你可能感兴趣的试题

A.矩形
B.椭圆形
C.菱形
D.正方形
A.System.out.println{"");
B.System.out.println{"*");
C.System.out.println{"/"};
D.System.out.println{"\"");
找试题 · 找答案 · 找资料 在线模考