小编Dir*_*leg的帖子

const auto*和const auto之间的区别?

我有这个代码:

const int a = 10;
const auto *b = &a; //0x9ffe34
const auto c = &a; //0x9ffe34

int z = 20;
b = &z; //0x9ffe38
//c = &z; //[Error] assignment of read-only variable 'c'
Run Code Online (Sandbox Code Playgroud)

为什么可以分配新地址b而不是c

c++ pointers const auto c++11

7
推荐指数
1
解决办法
1139
查看次数

标签 统计

auto ×1

c++ ×1

c++11 ×1

const ×1

pointers ×1