The const qualifier explicitly declares a data object as something that cannot be changed. Its value is set at initialization. You cannot use const data objects in expressions requiring a modifiable lvalue. For example, a const data object cannot appear on the left side of an assignment statement.
A const object cannot be used in constant expressions. A global const object without an explicit storage class is considered extern by default.
const int k = 10;
int ary[k]; /* allowed in C++, not legal in C */
const int k = 12; /* Different meanings in C and C++ */ static const int k2 = 120; /* Same meaning in C and C++ */ extern const int k3 = 121; /* Same meaning in C and C++ */Because its linkage is assumed to be internal, a const object can be more easily defined in header files in C++ than in C.
An item can be both const and volatile. In this case the item cannot be legitimately modified by its own program but can be modified by some asynchronous process.