const

下面定义是对的:

const int *a;

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

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

 

下面定义错误!

const *int e;

 

 

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

 

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

posted @ 2012-12-14 20:27  helloweworld  阅读(161)  评论(0编辑  收藏  举报