Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import "fmt"
- func main() {
- a := make([]byte, 100)
- b := a
- a[10] = 'y'
- b[10] = 'x'
- fmt.Println(a[10])
- fmt.Println(b[10])
- c := [3]byte{1, 2, 3}
- d := c
- c[2] = 'x'
- d[2] = 'y'
- fmt.Println(c[2])
- fmt.Println(d[2])
- g := c[:]
- h := g
- g[2] = 'x'
- h[2] = 'y'
- fmt.Println(g[2])
- fmt.Println(h[2])
- }
- /*
- Output
- 120
- 120
- 120
- 121
- 121
- 121
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement