+ 2
C - Why does this code, without casting x to int, return a garbage value?
float x = 1.99; printf("%d",x);
1 Réponse
+ 1
It is not garbage, numbers with decimal points are stored in different way than integers and when you try to print them in different type it fails. So, you have to cast it to get right value.