New

new() works for all data types (except channel, map) and dynamically allocates space for a variable of that type and initializes it with the zero value of that type and returns a pointer to it.


new(type)
                        

Another way to initialize a structure is as follows:


var myStruct type
// or
myStruct := type{}
                        
new.go