package main import "fmt" func main() { //引用变量赋值 var a string afuzhi(&a) fmt.Println(a) fmt.Println("=========================") bianliang() } func afuzhi(b *string) { *b = "ccc" //fmt.Println(b) } func bianliang() { var a = [3]int{1, 2, 3} var b = &a b[1]++ fmt.Println(a, b) } /* 输出结果 ccc ========================= [1 3 3] &[1 3 3] */
有疑问加站长微信联系(非本文作者)