Computer Science, asked by T4Talent, 1 year ago

(a) What are the default values of the primitive datatypes int and float?

Answers

Answered by tiara5
11

Ans. The default value of int is 0 and the default value of float is 0.0f.
Answered by shubhamsinhaiitg
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.

T4Talent: Wrong
shubhamsinhaiitg: Just google it please before you declare it wrong. :)
tiara5: in java there are default values if you don't know
shubhamsinhaiitg: My answer was wrt C language.
shubhamsinhaiitg: Try mentioning the language next time
T4Talent: Hm
Similar questions