(a) What are the default values of the primitive datatypes int and float?
Answers
Answered by
11
Ans. The default value of int is 0 and the default value of float is 0.0f.
Answered by
2
There is no default value as such. It depends on what value you initialize the variable with for eg.
int a = 0;
float a = 0.0;
If you don't initialize the variables, then some random value(within the range of that datatype) that is stored in the memory space of that variable previously will be assigned to the variable. Be careful! Always try to initialize your variables as per your need.
int a = 0;
float a = 0.0;
If you don't initialize the variables, then some random value(within the range of that datatype) that is stored in the memory space of that variable previously will be assigned to the variable. Be careful! Always try to initialize your variables as per your need.
T4Talent:
Wrong
Similar questions