notes blog about

Stack is a simple data structure that allows for two operations:

Functions form call stacks:

func main() {
    fmt.Println(f1())
}

func f1() int {
    return f2()
}

func f2() int {
    return 1
}
                    +----+
                    | f2 | return
                    +----+
          +----+    +----+        +----+
          | f1 | f2 | f1 |        | f1 | return
          +----+    +----+        +----+
+----+    +----+    +----+        +----+        +----+
|main| f1 |main|    |main|        |main|        |main|
+----+    +----+    +----+        +----+        +----+