Why the 'f' in de value of a float?

Hi there Forum,

Today I started working with SFML ( http://www.sfml-dev.org/ ) for a little school project I'm doing. I was reading the graphics tutorials when I came across some (for me) unknown float value's. I noticed them before but never paid them any attention, not needing them.

In the tutorial they used arguments like '200.f' and '1,5f'. I always define my variables just using a decimal value.

What are these f's for and when should I use them?

Thanks in advance!

Yuri
Last edited on
f tells the compiler that a value is float. if there is no f, a value like 2.5 is considered as double. there is generally nothing wrong with not writing the f, as far as I know.
I guess your program's memory footprint would be smaller if you specified floats where you really didn't need doubles but the advantage would be trivial for most apps.
Okay, I get it now :-D.
Thanks for the quick response!
Topic archived. No new replies allowed.