• the nature of pointer

  • const keyword
  1.  const int*  p
  2.  int const *p 
  3.  int*  const p
  4. int const a
  5. const int a

int a = 3;
int b = 5 ;
int* const p = &a;
*p =10;
//p = &b; error:  address can not be modified , but the content can be modified
const int* p2 = &a;
p2 = &b;
//*p2 = 7; error :  address can  be modified , but the content can not be modified
int const *p3 = &a;
p3 = &b;
//*p3 = 3; error :  address can  be modified , but the content can not be modified
//*p3 = 7; error

[C++] c pointer的更多相关文章

  1. 苹果手机不支持click文字 需要添加 cursor:pointer 才能 识别可以点击

    给一个div 绑定一个 click事件,  苹果手机会识别不了,必须添加一个 cursor:pointer 才能 识别可以点击.安卓正常识别.

  2. [LeetCode] Copy List with Random Pointer 拷贝带有随机指针的链表

    A linked list is given such that each node contains an additional random pointer which could point t ...

  3. Pointer's NULL And 0

    问题起源 在使用Qt框架的时候, 经常发现一些构造函数 *parent = 0 这样的代码. 时间长了, 就觉的疑惑了. 一个指针不是等于NULL吗? 这样写, 行得通吗? 自己测试一下就可以了. 测 ...

  4. C++中Reference与Pointer的不同

    Reference与Pointer中直接存储的都是变量的地址, 它们唯一的不同是前者的存储的地址值是只读的, 而后者可以修改. 也就是说Reference不支持以下操作: *a = b 其他语言, 如 ...

  5. LeetCode——Copy List with Random Pointer(带random引用的单链表深拷贝)

    问题: A linked list is given such that each node contains an additional random pointer which could poi ...

  6. Leetcode Copy List with Random Pointer

    A linked list is given such that each node contains an additional random pointer which could point t ...

  7. 移动端/H5关于cursor:pointer导致的问题

    cursor属性规定要显示的光标的类型(形状),该属性定义了鼠标指针放在一个元素边界范围内时所用的光标形状(不过 CSS2.1 没有定义由哪个边界确定这个范围). 不过,这个属性用在PC端没有任何问题 ...

  8. 关于编译报错“dereferencing pointer to incomplete type...

    今天同事问了我一个问题,他make的时候报错,“第201行:dereferencing pointer to incomplete type”,我随即查阅了很多资料,也没看出个所以然.最后问题得到了解 ...

  9. pointer to function

    指针.函数.数字.结构体.指针函数.函数指针 初学不好区分,做点儿实验来有效区分一下,以下代码采用dev-C++平台测试 //pointer to fucntion 函数功能是 基地址加偏移量得到偏移 ...

  10. TObject、Pointer、Interface的转换

    unit Unit4; ));   ));   ));   //将Obj转为接口   //LInf1 := ITest(Pointer(LObj1));       //无法转换了,丢失了接口信息   ...

随机推荐

  1. HL7 Tools suite

    HL7的官网有很多开源工具, 比如:RoseTree,V3Generator,RMIM Designer, Design Repository, V2 & V3 Mapping Tools等. ...

  2. linux下mysql提示"mysql deamon failed to start"错误的解决方法

    操作系统为centos,网站突然连接不上数据库,于是朋友直接重启了一下服务器.进到cli模式下,执行 service myqsld start 发现还是提示"mysql deamon fai ...

  3. DRF 解析器组件

    Django无法处理application/json协议请求的数据,即,如果用户通过application/json协议发送请求数据到达Django服务器,我们通过request.POST获取到的是一 ...

  4. Linnx 服务器中mysql 无法正常访问问题

    本机连接远程Linnx服务器不通 1. 检测防火墙 -- 保证防火墙关闭 查看到iptables服务的当前状态:service iptables status. 但是即使服务运行了,防火墙也不一定起作 ...

  5. eclipse插件-easy explore

    最近找到一个Eclipse的插件,名字是Easy Explore,是Easy Structs 其 中的一个部分.主要的功能就是在Eclipse里面视图的部分如果看到自己的工程,或者Package,包什 ...

  6. 【BZOJ】2456 mode(乱搞)

    Description 给你一个n个数的数列,其中某个数出现了超过n div 2次即众数,请你找出那个数. Input 第1行一个正整数n.第2行n个正整数用空格隔开. Output 一行一个正整数表 ...

  7. Web端优秀图表控件

    百度echart http://echarts.coding.io/doc/example.html C#+JQuery+.Ashx+百度Echarts 实现全国省市地图和饼状图动态数据图形报表的统计 ...

  8. struts2的搭建和简单的例子(采用struts-2.5.2版本)

    struts框架的概述: 当2001年初,Struts的第一个版本在apache网站上发布,它提供了一种分离视图和业务应用逻辑的web应用方案. 在Struts诞生之前,开发人员都是在jsp里写入处理 ...

  9. gif屏幕录像软件

    ScreenToGif:http://screentogif.codeplex.com       备份下载地址:http://flask.pub/screentogif2.zip 本站连接:http ...

  10. 爬虫之 图片懒加载, selenium , phantomJs, 谷歌无头浏览器

    一.图片懒加载 懒加载 :    JS 代码  是页面自然滚动    window.scrollTo(0,document.body.scrollHeight)   (重点) bro.execute_ ...