New course! Every coder should learn Generative AI!
Try a free lesson0
what is the use of const keyword in c++ ?
1 Answer
+ 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