The difference between a pointer and array name

指针和数组名的区别

主要是有三点

  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.

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容