So a constant would be any plain number like:
int a = 165; // assign a constant of type integer (because by default, it is type integer) to integer variable a
So the 165 is considered a constant until it is assigned to the variable a, because it is a plain number. So any number that is placed in the open like:
cout << 36 + 14;
is a constant. The statement above would be adding the constant 36 to the constant 14, and then displaying the answer. Right?
So the reason for the 'f' (in the original question) is to change the number to type float. Because it is type double until it is assigned to the float variable. So when I do something like this:
float a = 468;
I am actually assigning a type int to a float variable (a).
So does the type change to the variable type after it is assigned to the variable. Like:
1 2 3
|
float a = 468
a * 2
a* 2.1
|
After 468 is assigned to a, does that mean the number is now a type float, or is it still a type int, until it is multiplied by 2.1. Then, since type int cannot store fractions, does the number become a float?
Am I making sense?