1.看一段代码 func main() {
s1 := [5]int{0, 1, 2, 3, 4} s2 := s1 s2[0] = 999 fmt.Println(s1) //[0 1 2 3 4] s3 := []int{0, 1, 2, 3, 4} s4 := s3 s4[0] = 999 //[999 1 2 3 4] s3数组是值类型,s3 切片本身是个引用类型 fmt.Println(s3) }