If I try to print a float
as an int
, this code:
main () {
float a = 6.8f;
printf("%d", a);
}
prints 1073741824, while this code:
main () {
float a = 9.5f;
printf("%d", a);
}
prints 0.
Is the output undefined? Also when is %f
used with integer and %d
used with double?