牛客网上看见别人整理的,恍然大悟~~~
把*读作"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 */