ay******@gmail.com wrote:
Hello,
I am having a problem sending float parameter to a function in another
c file with its declaration in a common header file. When I send the
float with value 1.00000000, the receiving function gets 0. I suppose
the float value gets converted to double and then back to float with
only lower half of double (i.e. 0).
I am using ANSI C declaration. Does anyone know how to fix this. I am
running it on windows at the moment but i believe gcc on linux has the
same problem.
It is impossible from your description to even hazard a guess. Passing
float 9and other floating point) variables to functions is such
meat-and-potatoes stuff that you may be the only person who can't do it.
The only thing in your post that is at all suggestive of your problem
is "with its declaration in a common header file." Wherever your
defining declaration is, it does not belong in a header. If you must,
for some reason, declare files in a header, at least declare them extern
and have a defining declaration in one of your non-header translation units.