+ 2

Why we cant modify CONST variable once initialised

Please give the example.

11th Jan 2019, 6:38 PM
Ab Rt
9 Antworten
+ 7
const = constant = cannot be changed
11th Jan 2019, 8:18 PM
Ulisses Cruz
Ulisses Cruz - avatar
+ 7
Here is another link that explains const in several contexts including when declaring with volatile. https://stackoverflow.com/a/36529755
12th Jan 2019, 5:55 AM
David Carroll
David Carroll - avatar
+ 3
const is designated to create a variable which cannot be changed. it is fixed .https://stackoverflow.com/questions/2524585/the-benefits-of-constants
12th Jan 2019, 4:53 AM
Muhd Khairul Amirin
Muhd Khairul Amirin - avatar
+ 1
Thanks for your response. But why it cant be remodify? Is it because of memory location?
12th Jan 2019, 4:30 AM
Ab Rt
+ 1
Thank u all for answering! Where this const variables gets store? Is it in global or stack? Or seprate memory..
12th Jan 2019, 9:01 AM
Ab Rt
0
Thanks !
12th Jan 2019, 4:23 PM
Ab Rt
0
Thanks !
12th Jan 2019, 4:23 PM
Ab Rt