Go语言 之数组指针
package main import ( "fmt" ) func main() { var arr [3]int = [3]int{1, 2, 3} //将数组地址赋值给p p := &arr for _, v := range *p { fmt.Println(v) } }
package main import ( "fmt" ) func main() { var arr [3]int = [3]int{1, 2, 3} //将数组地址赋值给p p := &arr for _, v := range *p { fmt.Println(v) } }