• 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. WebApi FormData+文件长传 异步+同步实现

    // POST api/values public async Task Post() { try { // 检查该请求是否含有multipart/form-data if (!Request.Con ...

  2. (转)Inno Setup入门(七)——提供安装语言选项

    本文转载自:http://blog.csdn.net/yushanddddfenghailin/article/details/17250803 Inno Setup安装目录下有一个Languages ...

  3. xss 攻击 sql 注入

    XSS测试 "/><script>alert(document.cookie)</script><!-- <script>alert(docu ...

  4. Java Array 方法和使用

    1.Arrays.toString():数组转字符串 格式:Arrays.toString(数组名) 将数组转化成字符串,此时输出的结果是字符串类型. import java.util.Arrays; ...

  5. Windows2012使用笔记

    一.介绍 win 2012的名字于北京时间2012年4月18日公布,全称Windows Server 2012(下面简称win 2012),正式版于2012年9月4日发布.这是一套基于Windows ...

  6. 第三章 k8s cluster环境创建

    1  用如下方法安装指定版本的docker,但是我的环境会报错 # 安装rpm apt install rpm # 下载 RPM 包, docker 版本 wget https://download. ...

  7. 学生党如何拿到阿里技术offer: 《2016阿里巴巴校招内推offer之Java研发工程师(成功)》

    摘要: 这篇文章字字珠玑,这位面试的学长并非计算机相关专业,但是其技术功底足以使很多计算机专业的学生汗颜,这篇文章值得我们仔细品读,其逻辑条理清晰,问题把握透彻,语言表达精炼,为我们提供了宝贵的学习经 ...

  8. ALSA声卡10_从零编写之数据传输_学习笔记

    1.引言 (1)应用程序使用声卡的时候,数据流程是:应用程序把数据发送给驱动,驱动把数据发送给硬件声卡,声卡把数据转换成声音数据播放出去. (2)可以使用两种方式发送数据 第一种:app发数据,等驱动 ...

  9. redis存session问题测试内容

    转至元数据起始   官网,现网由于是双节点,session是存储在redis作为共享的. +1是单节点.目前是存储成文件的 本次的问题根源是 由于 session是存储在redis,所造成的. 所以需 ...

  10. Android Studio里面配置Tesseract

    网上大多是eclipse的项目,因为我用的是AS,所以说一下怎么配置. 身份证图片资料来自百度. 一.导入相关文件 其实我们不用自己编译,可以把别人项目编译好的jar包和so库直接拿来用.因为识别的效 ...