• 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. python3 内存管理

    怎么查找哪里存在内存泄露呢?武器就是两个库:gc.objgraph pip install psutil pip install objgraphpip install -U memory_profi ...

  2. postman 设置代理

    点击右上角 图标(亮着的为录制中) 设置端口 和存放位置 把浏览器设置代理 localhost 8080 即可 filter中可以通过正则表达式来匹配自己关心的url     2018.9 后记: 今 ...

  3. Java-Runoob:Java Number & Math 类

    ylbtech-Java-Runoob:Java Number & Math 类 1.返回顶部 1. Java Number & Math 类 一般地,当需要使用数字的时候,我们通常使 ...

  4. SQL 只取重复记录一条记录并且是最小值

    and not exists( and a.StateValue>StateValue ) '

  5. 竖屏拍照,但是sd卡中却是横屏解决方法

    protected void onActivityResult(int requestCode, int resultCode, Intent data) { switch (resultCode) ...

  6. 【学步者日记】C#反射中NonPublic和Instance需要一起使用

    完整链接请看: http://note.youdao.com/noteshare?id=f378d9a414e46893b0e300b017ed3655 ——————————————————————— ...

  7. css移除a标签及map、area(图片热区映射)点击过后的边框

    默认a标签及其包含的html元素和map中的area(图片热区映射)在点击过后留有默认的蓝色边框,如下图 可以看到,蓝色的边框破坏了页面的整体美感,很多时候我们都是不需要的.通过设置相应的css可以去 ...

  8. 爬虫高性能相关(协程效率最高,IO密集型)

    一背景常识 爬虫的本质就是一个socket客户端与服务端的通信过程,如果我们有多个url待爬取,采用串行的方式执行,只能等待爬取一个结束后才能继续下一个,效率会非常低. 需要强调的是:串行并不意味着低 ...

  9. (转) Docker EE/Docker CE简介与版本规划

    随着Docker的不断流行与发展,docker公司(或称为组织)也开启了商业化之路,Docker 从 17.03版本之后分为 CE(Community Edition) 和 EE(Enterprise ...

  10. swoole学习

    <?php ini_set('default_socket_timeout', -1); class serverEmail { public $serv = null; public func ...