标签:style blog color io ar sp div on log
The expression new(T)
allocates a zeroed T
value and returns a pointer to it.
var t *T = new(T)
or
t := new(T)
package main import "fmt" type Vertex struct { X,Y int } func main() { v :=new(Vertex) fmt.Println(v) v.X, v.Y = 11, 9 fmt.Println(v) }
标签:style blog color io ar sp div on log
原文地址:http://www.cnblogs.com/ghgyj/p/4053305.html