Skip to content

Instantly share code, notes, and snippets.

@AahanSingh
Created July 11, 2021 06:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AahanSingh/a5df4e8262e6de6c7ceafce451a2a76f to your computer and use it in GitHub Desktop.
Save AahanSingh/a5df4e8262e6de6c7ceafce451a2a76f to your computer and use it in GitHub Desktop.
Static stack push
func (s *Stack) push(x int) {
fmt.Println("Pushing", x, "to the stack.")
if s.isFull() {
fmt.Println("Stack Overflow")
return
}
(*s).top++
(*s).data[(*s).top] = x
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment