0

Constant

how we can change the value of constant.? const int x=10; x++; cout<<x;

16th Dec 2017, 4:20 PM
DevZohaib
DevZohaib - avatar
3 Antworten
+ 4
you can't change the value of const variables. but you can change memory address like... const int a = 1; const int *p = &a; cout << ++p;
24th Dec 2017, 4:43 PM
Zohaib 👑
Zohaib 👑 - avatar
+ 6
You can't, that's the whole idea of constant.
16th Dec 2017, 4:33 PM
Dennis
Dennis - avatar
+ 6
You can't change the value of a constant. The point of a constant is that it cannot be changed. You can change the value of a variable, though.
17th Dec 2017, 8:27 PM
Learnsolo