# Thread: Specifiying Constants L, UL, LL, f

1. ## Specifiying Constants L, UL, LL, f

I have looked this up in three books and Google has also failed me.

To me a constant is a value that doesn't not change. It defined by "const", "#define", or a convention of all capital letters to remind the programmer not to change the value.

What I am seeing is:
long Big_Number = 1287600L;
#define PI 3.141f

Is it keeping the variable type constant? I read that the type can be promoted during implicit conversions.

IF I guessed correctly, when should it be used?

If I guessed incorrectly, I am completely lost and don't know when to use it.

Thank You,
Carl

2. The variable type is specified in the declaration, e.g., radius is a float because you declared it to be a float. This is true whether or not the variable is declared const.

The suffix f is used to denote that the floating point literal (constant) is of type float.

3. I don't know if I am over thinking this or if I believe something that is wrong. I think I don't understand was is meant by "constant." The constants I keep finding references to are string constants.

Is this correct? I have to declare the "variable_name" type and the "value" type seperately.

4. Well I don't think there is any harm in thinking the way you do. But to be precise, there are literal constants, which refer to anonymous values. Examples include 5, 'H'; other things that Sesame Street are brought by; and "Hello world!" Even though these things have no name, they have a type. In larger expressions, you might apply a suffix to make sure that the literal is the correct type so that no implicit conversions mess with the result of the calculation (or whatever). Then there are constant variables, which refer to, and qualify, things that you've defined in your program. They usually store literal constants like variables do.

5. I believe I clearly understand now. It seemed redundant so I wanted to be sure I had the right train of thought. The "2.0f" in the expression circumference = 2.0f*PI*radius; makes sense now to.

Thanks to both of you!!