c++ cannot assign to a variable that is const
The const keyword specifies that a variable's value is constant and tells the compiler to prevent the programmer from modifying it. In C++, you can use the const keyword instead of the #define preprocessor directive to define constant values. Values defined with const are subject to type checking, and can be used in place of constant expressions. In C++, you can specify the size of an array with a const variable as follows: Copy.