I have an const
array in global scope like this:
const long array_test[5] = {1, 2, 3, 4, 5};
How do I modify the elements of the above array at runtime using a pointer?
I have an const
array in global scope like this:
const long array_test[5] = {1, 2, 3, 4, 5};
How do I modify the elements of the above array at runtime using a pointer?
You can't. The const
keyword is used to create a read only variable. Once initialised, the value of the variable cannot be changed but can be used just like any other variable. That means, a const
qualified variable must not be assigned to in any way during the run of a program.