const int* p; 指针指向的值不可变,但指针本身可变。
int const* p; 指针指向的值不可变,但指针本身可变。
int*
const p; 指针指向的值可变,但指针本身不可变。
const int* const p; 指针本身和指向的值都不可变。
int const* const p; 指针本身和指向的值都不可变。
本文详细解析了 C++ 中四种不同类型的指针常量:const int* p, int const* p, int* const p 和 const int* const p 的含义及使用场景,帮助读者理解这些指针特性。
const int* p; 指针指向的值不可变,但指针本身可变。
int const* p; 指针指向的值不可变,但指针本身可变。
int*
const p; 指针指向的值可变,但指针本身不可变。
const int* const p; 指针本身和指向的值都不可变。
int const* const p; 指针本身和指向的值都不可变。

被折叠的 条评论
为什么被折叠?