+ 1
When storing values, will I always have to use int myVariable?
3 Respuestas
+ 7
No. You replace int with the datatype you wish to use such as char, bool, float, double, void etc. Using int will store a number or "integer" value, meaning it has to be explicitly that and not the alternatives.
0
The "naming convention" is primarily best if its meaningful. For example, If you're creating a variable that will store a rounded version of "pi" then it makes sense to name your variable:
float pi = 3.14;
Instead of
float number = 3.14;
This is basic programming practice.