0
{C language} why those are not same?
#include <stdio.h> int main() { float a=10.5; printf("%d",sizeof (a)) ; printf("\n"); printf("%d",sizeof 10.5) ; return 0; }
6 Answers
+ 2
In C , a floating number is double unless you specify it.
Try sizeof 10.5f
+ 1
Thanks for the answer
+ 1
Hima Nothing wrong.. i mean floating number means float type number we think in c. So better to call decimal number or floating point number.. (I mean there confusing)..
float type have always 4 bytes.. Decimal numbers have fraction part, no limitation (single precision, double precitions)
+ 1
In C language, floating-point constant is double precision floating-point type by default.
0
@Hima "a floating number is double" is confusing.... It may be better to say "Defaultly a decimal value is double type in c"
So 10.5 double value
10.5f is float type, also a is float type..
0
Jayakrishnađźđł what's wrong with floating number ? And why it's conflicting ?
"floating point numbers are numbers that contain floating decimal points."