64,646
社区成员
发帖
与我相关
我的任务
分享
int const* p = &a;
等价于
const int * p = &a;
即为底层const,p指向的内容是常量,而p本身是可以修改的。
如果要将p声明为顶层const,则代码为
int* const p = &a;
之后,如果为p赋新的值,则报错。
以下这篇文章中提到了上述内容。
《C++函数的返回值(下)》
http://blog.csdn.net/hou09tian/article/details/78586162
希望能够帮到你