Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我const在全局范围内有一个数组,如下所示:
const
const long array_test[5] = {1, 2, 3, 4, 5};
如何在运行时使用指针修改上述数组的元素?
绝不。您不能修改const对象。
你不能。该const关键字用于创建只读变量。初始化后,变量的值不能更改,但可以像任何其他变量一样使用。这意味着,const在程序运行期间不得以任何方式分配限定变量。