What is the default value of a local variable in go?



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

Post New Answer

More Go Programming Language Interview Questions

Does go (golang) support generic programming?

1 Answers  


What is syntax like in go programming language?

1 Answers  


How a pointer is represented in go?

1 Answers  


What is slice?

1 Answers  


What are the differences in len() and cap() functions of slice in go?

1 Answers  


Does go support pointer arithmetics?

1 Answers  


How can you distribute tasks in go to different machines?

1 Answers  


Does golang support operator overloading?

1 Answers  


List some of the advantages of go language?

1 Answers  


What are methods in go?

1 Answers  


Is go (golang) a case sensitive language?

1 Answers  


What are the advantages of go?

1 Answers  


Categories