首页 > 其他 > 详细

const关键字用法

时间:2015-06-03 21:12:08      阅读:229      评论:0      收藏:0      [点我收藏+]

* 读作 pointer to,从右向左读

 

<type> * const p   变量p存放在read-only数据段,p为常量指针,p只用于读操作, 告诉编译器,p仅用做右值;

读作:p is const pointer to <type>

 

  const <type> *p   变量p存放在栈区; *p不一定为常量区,但*p只用于读操作,告诉编译器*p仅用作右值;

<type> const *p == const <type> *p

读作:p is pointer to const <type>

 

附加:

参考链接 :http://blog.csdn.net/luoyeaijiao/article/details/7982385             C中const的实现机制

 

const关键字用法

原文:http://www.cnblogs.com/xiaokuang/p/4550147.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!