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

Function Push

code/ds/SqStack.cpp:29–40  ·  view source on GitHub ↗

进栈

Source from the content-addressed store, hash-verified

27
28// 进栈
29bool Push(SqStack &S,ElemType x){
30 if(S.top==MaxSize-1){
31 // 栈满,返回false,元素无法进行进栈操作
32 return false;
33 }else{
34 // 可进栈,栈顶指针+1,再元素入栈
35 S.data[++S.top]=x;
36
37 // 入栈成功
38 return true;
39 }
40}
41
42
43// 出栈

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected