Converting floating point to integers
I'm having a little problem with converting floating point values to integers. if I do something like this:
float f = 245.56;
int i;
i = (int)f;
printf("%d\n", i);
the output will be 0. Can anyone explain this problem? Do I need an explicit conversion? If so, where could I find documentation on it?
|