Hi I’m trying to convert from an int to a float in C and for some reason the cast changes the value and I’m not sure why. So:
fprintf (stderr, "%d,%d\n", rgbValues->green, (float)rgbValues->green);
produces two different numbers. Note that rgbValues->green is an int.
Any idea why this is happening?
Thanks
You have to say that in your format string. Use:
instead of:
Note the change from
dtof(the circumflex^isn’t part of the code, just an indicator as to where to look).