What is default value of a global and local variable in go?
Answer / Prabhanjan Kumar
The default value of an uninitialized global variable in Go is the zero value of its type. For example, for numeric types like int, float, etc., the default value is 0, while for strings it's empty (""). Local variables are not initialized by default and will cause a compile-time error if used before assignment.
| Is This Answer Correct ? | 0 Yes | 0 No |
Can we declare a class in go?
What is the syntax for for-loop in go?
What is cgo golang?
Does go support generic programming?
What is type casting in go programming?
Why golang is fast?
What is difference between concurrent and parallel in golang?
How can you distribute tasks in go to different machines?
What is a pointer in go?
List the looping constructs in go language.
What are the differences in len() and cap() functions of slice in go?
What is type assertion in go? What does it do?