0

what is the use of const keyword in c++ ?

13th Sep 2016, 6:49 PM
Sandeep Singh
Sandeep Singh - avatar
1 Respuesta
+ 1
It is used to declare constants. The affected variable cannot be reassigned a value. const int ANSWER = 42; ANSWER = 1337; //won't work, ANSWER is still 42
14th Sep 2016, 8:56 AM
Zen
Zen - avatar