pointer.go 221 B

123456789101112
  1. package main
  2. import "fmt"
  3. func main() {
  4. var i1 = 5
  5. fmt.Printf("An integer: %d, its location in memory: %p\n", i1, &i1)
  6. var intP *int
  7. intP = &i1
  8. fmt.Printf("The value at memory location %p is %d\n", intP, *intP)
  9. }