Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/GoTurkiye/training
/ Push
Method
Push
301-algorithms/linear-lists/stack/stack.go:19–25 ·
view source on GitHub ↗
(value MyItem)
Source
from the content-addressed store, hash-verified
17
}
18
19
func
(s *Stack) Push(value MyItem) {
20
if
s.depth >= s.capacity {
21
panic(
"out of cap"
)
22
}
23
s.list[s.depth] = value
24
s.depth++
25
}
26
27
func
(s *Stack) Pop() MyItem {
28
if
s.depth > 0 {
Callers
1
main
Function · 0.95
Calls
no outgoing calls
Tested by
no test coverage detected