package main import "fmt" func main(){ slices := make([]int,5,10) bs := slices fmt.Println("before changing.......") for _,i := range slices{ fmt.Println(i) } for _,i := range bs{ fmt.Println(i) } slices[1]++ fmt.Println("after changing.......") for _,i := range slices{ fmt.Println(i) } for _,i := range bs{ fmt.Println(i) } }
关于值语义与引用语义
有疑问加站长微信联系(非本文作者)