const

下面定义是对的:

const int *a;

int *const b;    //b指向不可改

int const *c;    //c指向的变量的值不可改

下面定义错误!

const *int e;

const在*的左边则指向的变量值只读,const在*的右边则指针指向只读,即“左定值,右定向”!

注意:左定值右定向的参照物是*   !!!

原文地址:https://www.cnblogs.com/helloweworld/p/2818634.html