package main
import "fmt"
type Person struct {
Name string
}
func main() {
c := new(Person) // 返回指针
c.Name = "Catherine"
fmt.Println(c.Name) // prints: Catherine
d := c
d.Name = "Daniel"
fmt.Println(c.Name) // prints: Daniel
// 在指针前面添加星号以对指针解引用
i := *d
i.Name = "Ines"
fmt.Println(c.Name) // prints: Daniel
fmt.Println(d.Name) // prints: Daniel
fmt.Println(i.Name) // prints: Ines
}
// 译者注,可以尝试打印c,d,i变量各自的地址和值看看