About
The expression new(T):
- initializes it to the zero value of T,
- and returns its address, which is a value of type *T.
new is a predeclared function, not a keyword,
Articles Related
Example
p := new(int)
fmt.Println(*p) // "0"
then:
- p has the type *int, points to an unnamed int variable