+ 1

When storing values, will I always have to use int myVariable?

23rd Feb 2017, 10:41 PM
Shauntae Taylor
Shauntae Taylor - avatar
3 Respostas
+ 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.
23rd Feb 2017, 10:50 PM
Mark Foxx
Mark Foxx - avatar
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.
24th Feb 2017, 2:09 AM
ivann