您的位置:首页 > 编程语言 > C语言/C++

c++笔记,指针的定义

2017-08-01 13:56 106 查看
牛客网上看见别人整理的,恍然大悟~~~

把*读作"pointer to",从右至左念:

b是一个常量
const int b;  /* b is a int const */
int const b;  /* b is a const int */

p是一个普通指针,指向一个常量
const int *p; /* p is a pointer to int const */

int const *p; /* p is a pointer to const int */

p是一个常量指针,指向一个普通变量
int *const p;  /* p is a const pointer to int */

p是一个常量指针,指向一个常量
const int *const p;  /* p is a const pointer to int const */

int const *const p;  /* p is a const pointer to const int */
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: