call me - Functions - Ponter types, Getting or changing the value at a pointer
Head First Go、 Jay McGavren(著)、O’Reilly Media)の Chapter 3(call me - Functions)、p.106(Code Magnets)の解答を求めてみる。
コード
sample.go
package main
import "fmt"
func main() {
var myInt int
var myIntPointer *int
myInt = 42
myIntPointer = &myInt
fmt.Println(*myIntPointer)
}
入出力結果(Terminal, Zsh)
% go run ./sample.go
42
%