Source file tour/moretypes/pointers.go
1 //go:build OMIT 2 3 package main 4 5 import "fmt" 6 7 func main() { 8 i, j := 42, 2701 9 10 p := &i // point to i 11 fmt.Println(*p) // read i through the pointer 12 *p = 21 // set i through the pointer 13 fmt.Println(i) // see the new value of i 14 15 p = &j // point to j 16 *p = *p / 37 // divide j through the pointer 17 fmt.Println(j) // see the new value of j 18 } 19