What is the default value of a local variable in go?
Answer / Harshit Kumar Vishnoi
The default value of a local variable in Go depends on its data type. For example, integer types like int and int8 have a default value of 0, float64 has a default value of 0.0, boolean is false, pointers are nil, structs and arrays are initialized to their zero values (which means all fields are set to their respective zero values), and interfaces and function type variables are nil.
| Is This Answer Correct ? | 0 Yes | 0 No |
What is cgo golang?
List out the built in support in go?
What is gopath environment variable in go programming?
What are goroutines?
What is the usage of goto statement in go programming language?
Explain static type declaration of variable in go programming language?
What is default value of a global and local variable in go?
What is type casting in golang?
Explain why type assertion is used in go language?
Does go (golang) support type inheritance?
What is l-value and r-value in go?
What type assertion is used for and how it does it?