美文网首页c++ primer note
The difference between a pointer

The difference between a pointer

作者: lusoer | 来源:发表于2017-02-21 22:35 被阅读16次

指针和数组名的区别

主要是有三点

  1. 首先是声明一个数组的时候,数组名是作为数组的初始化名的
  2. 使用sizeof()的时候,对于数组名来说返回的是一个整个数组的字节数
  3. &arrname返回的是一个指向整个数组的指针。

常指针和普通指针的注意点

const type pointer can point to const data type and non-const data type; However a normal pointer cannot point to a const because if so it means that you can change the value of a const through the normal pointer. But there is a trick that you cannot assign the value of a normal pointer to a const type pointer to pointer because this kind of pointer to pointer end up pointing to a const value,but once you point to a normal pointer,you can change the value of this const data.

相关文章

网友评论

    本文标题:The difference between a pointer

    本文链接:https://www.haomeiwen.com/subject/jzqpwttx.html