← BYTES
Go·Starter·Ref: 10.1.3

What is the zero value of an int variable that is declared but not explicitly initialized?

Have a question about this video? Mention reference 10.1.3 when you contact us.

a.nil
b.undefined, reading it is a compile error
c.An implementation-defined garbage value, like uninitialized memory in C
d.0
Go guarantees every variable is automatically initialized to its type's zero value if no explicit initializer is given -- for numeric types that zero value is 0, removing an entire class of uninitialized-memory bugs common in C.

Find this on YouTube & Instagram

Every BYTES video is tagged with its reference number and topic — search any of these on YouTube or Instagram to find this one:

#BYTES#BYTES1013#Go