Advertisement
Guest User

Untitled

a guest
Aug 20th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. package main
  2.  
  3. import "fmt"
  4.  
  5. func main() {
  6. i, j := 42, 2701
  7.  
  8. p := &i // point to i
  9. fmt.Println(*p) // read i through the pointer
  10. *p = 21 // set i through the pointer
  11. fmt.Println(i) // see the new value of i
  12.  
  13. p = &j // point to j
  14. *p = *p /37 // divide j through the pointer
  15. fmt.Println(j) // see the neww value of j
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement