0

Whats the difference between the variable and comstant

if we write a variable for example like this int my age how should we write a constant

20th Feb 2017, 7:43 PM
Bassel AbdelSabour
Bassel AbdelSabour - avatar
4 Answers
+ 2
const int my_age = 43; Variable names shouldn't contain a space. Well, any identifier shouldn't contain a space.
21st Feb 2017, 6:22 PM
Tim Helland
Tim Helland - avatar
+ 1
a variable can change its value during the execution, a constant cant, in fact, a constant during the compiling is processed by the precompiler. this means that before the compiler all constants are change to its value
20th Feb 2017, 7:52 PM
sebipincha
sebipincha - avatar
0
and constant names can contain a space or what?
20th Feb 2017, 7:52 PM
Bassel AbdelSabour
Bassel AbdelSabour - avatar
0
sebipincha i understand but why in lesson 2 they wrote int myage=34 the age can be changed cause its a variable
20th Feb 2017, 7:54 PM
Bassel AbdelSabour
Bassel AbdelSabour - avatar