0
What is const in cpp?
3 Antworten
+ 7
A constant is an expression with a fixed value. It cannot be changed while the program is running.
Use the const keyword to define a constant variable.
https://www.sololearn.com/learn/CPlusPlus/1895/
+ 1
For example
const float pi = 3.14;
As you don't want to change value any time during the execution this won't let you do it by mistake.
0
If we declare value as a const in a program we can't change that value, That value is fixed value in that program