go-playground/da_tour/datour/pointers.go

14 lines
165 B
Go

package datour
import "fmt"
func Pointers() {
i, j := 24, 2701
p := &i // point to i
fmt.Println(*p) // read i through the pointer
*p = 21
p = &j
}