Gamestudio Links
Zorro Links
Newest Posts
M1 Oversampling
by Petra. 04/24/24 10:34
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Data from CSV not parsed correctly
by EternallyCurious. 04/20/24 21:39
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
folder management functions
by VoroneTZ. 04/17/24 06:52
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (AndrewAMD, Ayumi, Quad, PeWi), 488 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Format code for printing Float is Lite-C #470450
01/15/18 12:23
01/15/18 12:23
Joined: Jul 2017
Posts: 784
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 784
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?

Re: Format code for printing Float is Lite-C [Re: Zheka] #470451
01/15/18 13:01
01/15/18 13:01
Joined: Apr 2008
Posts: 586
Austria
Petra Offline
Support
Petra  Offline
Support

Joined: Apr 2008
Posts: 586
Austria
It prints garbage I think. %f is for var, not for float, so typecast it to (var).

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


Re: Format code for printing Float is Lite-C [Re: Petra] #470452
01/15/18 13:08
01/15/18 13:08
Joined: Jul 2017
Posts: 784
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 784
Thanks, this surely works. RFM:-)


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1