Format code for printing Float is Lite-C

Posted By: Zheka

Format code for printing Float is Lite-C - 01/15/18 12:23

Hello,

i am puzzled:
Quote:
int main ()
{
float a;
a=1.0;
printf("%f",a);
}
prints (in Zorro)
Quote:
0.007813

What's the correct format code to use? And what did actually print in the above example?
Posted By: Petra

Re: Format code for printing Float is Lite-C - 01/15/18 13:01

It prints garbage I think. %f is for var, not for float, so typecast it to (var).

http://manual.zorro-project.com/printf.htm

Posted By: Zheka

Re: Format code for printing Float is Lite-C - 01/15/18 13:08

Thanks, this surely works. RFM:-)
© 2024 lite-C Forums