Open utterances-bot opened 1 year ago
func main() { s := "脑子进煎鱼了" fmt.Printf("main 内存地址:%p\n", &s) hello(&s) }
func hello(s *string) { fmt.Printf("hello 内存地址:%p\n", &s) }
func main() { s := "脑子进煎鱼了" fmt.Printf("main 内存地址:%p\n", &s) hello(&s) }
func hello(s *string) { fmt.Printf("hello 内存地址:%p\n", &s) }
func main() { s := "脑子进煎鱼了" fmt.Printf("main 内存地址:%p\n", &s) hello(&s) }
func hello(s *string) { fmt.Printf("hello 内存地址:%p\n", &s) } hello里面不应该是这样打印吗? fmt.Printf("hello 内存地址:%p\n", s) 这样打印出来结果是一样的
群里又吵起来了,Go 是传值还是传引用?
https://eddycjy.com/posts/go/value-quote/