Junior — Senior
What output will appear in the console (example 27)
livecode
Task condition
Determine what text will be printed to the console after executing the following program.
import (
"fmt"
)
func main() {
a := 10
b := 20
ptr := &b
defer printInt("a", a)
defer printInt("ptr as value", ptr)
defer printIntPointer("ptr as pointer", *ptr)
a = 1010
*ptr = 2020
}
func printInt(name string, val int){
fmt.Printf("%s=%d\n", name, val)
}
func printIntPointer(name string, val *int) {
fmt.Printf("%s=%d\n", name, *val)
}