Skip to content

Instantly share code, notes, and snippets.

@kicool
Created March 31, 2013 10:33
Show Gist options
  • Save kicool/5280237 to your computer and use it in GitHub Desktop.
Save kicool/5280237 to your computer and use it in GitHub Desktop.
package main
import "fmt"
func main() {
a := make([]int, 1, 100)
a[0] = 10
fmt.Printf("a:%v, &a[0] %p, &a %p\n\n", a, &a[0], &a)
b := append(a, 20)
fmt.Printf("a:%v, &a[0] %p, &a %p\n", a, &a[0], &a)
fmt.Printf("b:%v, &b[0] %p, &b %p\n\n", b, &b[0], &b)
c := append(a, 30)
fmt.Printf("a:%v, &a[0] %p, &a %p\n", a, &a[0], &a)
fmt.Printf("b:%v, &b[0] %p, &b %p\n", b, &b[0], &b)
fmt.Printf("c:%v, &c[0] %p, &c %p\n", c, &c[0], &c)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment