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

Function GetTop

code/ds/SqStack.cpp:58–71  ·  view source on GitHub ↗

读(获取)栈顶元素

Source from the content-addressed store, hash-verified

56
57// 读(获取)栈顶元素
58bool 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}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected