Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import "fmt"
- func main() {
- i, j := 42, 2701
- p := &i // point to i
- fmt.Println(*p) // read i through the pointer
- *p = 21 // set i through the pointer
- fmt.Println(i) // see the new value of i
- p = &j // point to j
- *p = *p /37 // divide j through the pointer
- fmt.Println(j) // see the neww value of j
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement