August 2019
Beginner to intermediate
798 pages
17h 2m
English
Go supports the new keyword, which allows you to allocate new objects. However, there is a very important detail that you need to remember about new: new returns the memory address of the allocated object. Put simply, new returns a pointer.
So, you can create a fresh aStructure variable as follows:
pS := new(aStructure)
After executing the new statement, you are ready to work with your fresh variable that has its allocated memory zeroed but not initialized.
Read now
Unlock full access