The following code creates a usable instance of the struct, Car. How is this different than using new(Car)?
Example:
type Car struct {
make string
}
func Main() {
var car Car; // how is this different than "car := new(Car)"?
car.make = "Honda"
}
One defines a Car variable, the other returns a pointer to a Car.
car := new(Car)can be implemented in relation tovar car Carlike this: