type person struct{}
var tom *person = &person{}
當我使用
fmt.Printf("%+v\n", tom)//prints:&{}
爲什麼結果是&加上數據?這是surposed是一個地址(0x0055自)
當我使用
fmt.Printf("%+v\n", &tom)//0x0038
fmt.Printf("%p\n", &tom)//0x0038
它給了我一個地址,它給了我0x0038,爲什麼%v和%p具有相同的結果?
所以指針值將自動deferenced? – user3505400
當你使用%v時,是的。 –
@VitorDeMario我困惑,請幫助我。我剛剛評論了一些行。 http://play.golang.org/p/cvfngZnYeC – alioygur