出栈
| 42 | |
| 43 | // 出栈 |
| 44 | bool Pop(SqStack &S,ElemType &x){ |
| 45 | if(S.top==-1){ |
| 46 | // 栈空,无栈顶元素可出栈,返回false |
| 47 | return false; |
| 48 | }else{ |
| 49 | // 栈非空,先元素出栈,再进行指针-1 |
| 50 | x=S.data[S.top--]; |
| 51 | |
| 52 | // 出栈成功,返回true |
| 53 | return true; |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | // 读(获取)栈顶元素 |
| 58 | bool GetTop(SqStack S,ElemType &x){ |
nothing calls this directly
no outgoing calls
no test coverage detected