码迷,mamicode.com
首页 > 其他好文 > 详细

const关键字

时间:2017-07-24 10:06:07      阅读:106      评论:0      收藏:0      [点我收藏+]

标签:基本   str   const关键字   bsp   数据   关键字   类型   只读   nbsp   

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

 

2》修饰指针:

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

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

  ②、int * const p;

    const将p变为只读数据

  ③、const int * const p;

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

const关键字

标签:基本   str   const关键字   bsp   数据   关键字   类型   只读   nbsp   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!