MCPcopy Create free account
hub / github.com/TheAlgorithms/Go / Push

Method Push

structure/stack/stackarray.go:22–24  ·  view source on GitHub ↗

Push adds an element to the top of the stack.

(value T)

Source from the content-addressed store, hash-verified

20
21// Push adds an element to the top of the stack.
22func (s *Array[T]) Push(value T) {
23 s.elements = append(s.elements, value)
24}
25
26// Size returns the number of elements in the stack.
27func (s *Array[T]) Length() int {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected