suffixes

Can someone explain the suffixes alittle vetter to me? I read the tutorial on the site of constants that includes suffixes and it just conpletely confusrd me I dont understand that part at all. Also octal decimal and hexadecimal? What are those?
Suffixes are just a way to tell the compiler that you wish a literal value to have a specific type.

For example, if you type

0.0

...then the compiler will assume it is a double. That shouldn't normally matter, but you may wish it to be a float. Use a suffix to tell the compiler to make it a float and not a double:

0.0f

For octal, etc... there are different ways of writing the same number. You are used to the Arabic method, where we use the digits 0 through 9 (ten different values -- making numbers written this way radix=10 numbers, or decimal numbers). Try some google-fu to learn more about binary, octal, and hexadecimal.

Good luck!
So would you still have to say what it is?

Like are these two the same?

1
2
float x = 0.0;
x = 0.0f;
Last edited on
Bump
Yessir you still have to declare what it is (generally, not including templates, or the c++11 auto keyword)
Topic archived. No new replies allowed.