package main

import "fmt"

func test()  {
	var p *int // 定义指针
	var a = 10
	p = &a // 将a的地址赋值给指针

	fmt.Println(p,*p) // 获取a的值

	// 指针数组
	var aa ,bb int
	pointArr := [2]*int {&aa,&bb}

	fmt.Println(pointArr)

	// 数组指针
	arr := [...]int{1,2}
	var c *[2]int
	c = &arr
	fmt.Println(c)

}

func main()  {
	test()
}

  

GOROOT=/usr/local/go #gosetup
GOPATH=/www/gopath #gosetup
/usr/local/go/bin/go build -i -o /private/var/folders/fc/4txmmczj6q92p6058h3w7t_80000gn/T/___go_build_main_go__2_ /www/go/learn/main.go #gosetup
/private/var/folders/fc/4txmmczj6q92p6058h3w7t_80000gn/T/___go_build_main_go__2_ #gosetup
0xc0000b4010 10
[0xc0000b4030 0xc0000b4038]
&[1 2]