Declare a Float

if you are declaring a float ( ie: float scale{4.0f}; ) why are you initializing it with an “f” if its already a float?

In c++ even though you have giving it a float parameter, the compiler while still treat it as a double by default, so we give the f to explicitly tell the compiler that it is a float, and matches the float parameter giving.

5 Likes

Could not have said it better myself!

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms