When a pointer is created using the 'new' keyword, it is initialized to _______.

  • 0
  • default value
  • empty
  • nil
In Go, when a pointer is created using the 'new' keyword, it is initialized to nil. This means it does not point to any memory address initially. It's crucial to check for nil pointers to avoid runtime errors when dereferencing them.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *