指针的基本作用
func TestPoint(){
var count int = 20
var countPoint *int
var countPoint1 *int
countPoint = &count 取 count变量的地址给指针
fmt.Println(&count) 变量的地址 c0000005
if countPoint != nil{
fmt.Println(countPoint) 指针 c0000005
fmt.Println(*countPoint) 取出指针指向地址的值 20
}
fat.Println(countPoint1) nil
}
指针的数组
func TestPointArr(){
//指针数组
a,b = 1,2
pointArr := […]*int(&a,&b)
fat.Println(pointer) [0X0000054058 0Xc0000054070] 指针数组
//数组指针
arr := […]int{3,4,5}
arrPoint := &arr
fat.Println(arrPoint) &[3 4 5] 数组指针
}