理解Golang中的数组(array)、切片(slice)和map
我比较喜欢先给出代码,然后得出结论
数组
packagemain
import( "fmt" )
funcmain(){ arr:=[...]int{1,2,3} //打印初始的指针 fmt.Printf("thepointeris:%p\n",&arr) printPointer(arr) }
funcprintPointer(anyinterface{}){ fmt.Printf("thepointeris:%p\n",&any) }