MCPcopy Create free account
hub / github.com/142vip/408CSFamily / Pop

Function Pop

code/ds/SqStack.cpp:44–55  ·  view source on GitHub ↗

出栈

Source from the content-addressed store, hash-verified

42
43// 出栈
44bool 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// 读(获取)栈顶元素
58bool GetTop(SqStack S,ElemType &x){

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected