|
|
Const Variables |
|
The keyword const can be used to make a variable
unchangeable.
The variable must be initialized at the same time it is declared.
const int x = 5;
Can be used in function parameter lists to ensure the parameter cannot be changed.
| GOOD | ERROR |
|---|---|
void function (int x[]) {
|
void function (const int x[]) {
|