package main import "fmt" type Sum struct { x_val int y_val int } func main() { // 堆代码 duidaima.com // Allocate enough memory to store a Sum structure value // and return a pointer to the value's address var sum Sum p := &sum fmt.Println(p) // Use a composite literal to perform //allocation and return a pointer // to the value's address p = &Sum{} fmt.Println(p) // Use the new function to perform allocation, //which will return a pointer to the value's address. p = new(Sum) fmt.Println(p) }