读(获取)栈顶元素
| 56 | |
| 57 | // 读(获取)栈顶元素 |
| 58 | bool GetTop(SqStack S,ElemType &x){ |
| 59 | |
| 60 | if(S.top==-1){ |
| 61 | // 栈空,无栈顶元素,返回false |
| 62 | return false; |
| 63 | }else{ |
| 64 | |
| 65 | // 通过栈顶指针,获取栈顶元素,赋值给变量x |
| 66 | x=S.data[S.top]; |
| 67 | |
| 68 | // 读取栈顶元素成功,返回true |
| 69 | return true; |
| 70 | } |
| 71 | } |
nothing calls this directly
no outgoing calls
no test coverage detected