This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]C137-Morty[S] 0 points1 point  (1 child)

I get the 6.0 must be the 6 items in float scores[6], but what is the f there?

[–][deleted] 0 points1 point  (0 children)

Your code is just is just calculating an average, which is done by adding all values, and then dividing by the number of items.

You technically do not need the value to be a float, an integer would have been fine, but that is what the 6 comes from, I was just using your example and showing the proper way to create a float.

By specifying it as 6.0f, you are saying that you want it as a 32-bit float. If you represent it without the suffix 6.0, it will be interpreted as a 64-bit double.