首页 > 其他 > 详细

const关键字

时间:2017-07-24 09:35:26      阅读:235      评论:0      收藏:0      [点我收藏+]

1》修饰基本类型变量(使其只读)

 

2》修饰指针:

  ①、int const *p或者const int *p;

    *p是只读的,不可以通过指针修改,可以通过变量修改;

  ②、int * const p;

    const将p变为只读数据

  ③、const int * const p;

     const将p和*p都变为只读数据

const关键字

原文:http://www.cnblogs.com/feige1314/p/7226980.html

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