[{"createTime":1735734952000,"id":1,"img":"hwy_ms_500_252.jpeg","link":"https://activity.huaweicloud.com/cps.html?fromacct=261f35b6-af54-4511-a2ca-910fa15905d1&utm_source=V1g3MDY4NTY=&utm_medium=cps&utm_campaign=201905","name":"华为云秒杀","status":9,"txt":"华为云38元秒杀","type":1,"updateTime":1735747411000,"userId":3},{"createTime":1736173885000,"id":2,"img":"txy_480_300.png","link":"https://cloud.tencent.com/act/cps/redirect?redirect=1077&cps_key=edb15096bfff75effaaa8c8bb66138bd&from=console","name":"腾讯云秒杀","status":9,"txt":"腾讯云限量秒杀","type":1,"updateTime":1736173885000,"userId":3},{"createTime":1736177492000,"id":3,"img":"aly_251_140.png","link":"https://www.aliyun.com/minisite/goods?userCode=pwp8kmv3","memo":"","name":"阿里云","status":9,"txt":"阿里云2折起","type":1,"updateTime":1736177492000,"userId":3},{"createTime":1735660800000,"id":4,"img":"vultr_560_300.png","link":"https://www.vultr.com/?ref=9603742-8H","name":"Vultr","status":9,"txt":"Vultr送$100","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":5,"img":"jdy_663_320.jpg","link":"https://3.cn/2ay1-e5t","name":"京东云","status":9,"txt":"京东云特惠专区","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":6,"img":"new_ads.png","link":"https://www.iodraw.com/ads","name":"发布广告","status":9,"txt":"发布广告","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":7,"img":"yun_910_50.png","link":"https://activity.huaweicloud.com/discount_area_v5/index.html?fromacct=261f35b6-af54-4511-a2ca-910fa15905d1&utm_source=aXhpYW95YW5nOA===&utm_medium=cps&utm_campaign=201905","name":"底部","status":9,"txt":"高性能云服务器2折起","type":2,"updateTime":1735660800000,"userId":3}]
以前总是搞不懂指针这一章节的知识,学得非常的混乱,这可不,马上要考试了,必须火力全开呀,今天在CSDN博客上看到一篇关于指针的知识点总结,觉得受益匪浅,感触颇丰!
<>指针
指针的定义:
指针是一个变量,用来存放地址的变量
指针的类型:
(1)基本类型:int 、short、long、float 、double、char
如 int *p;//表示定义一个指针,这个指针指向整形变量,这个指针将存放的是整形变量的地址。
**(2)数组指针:**指针指向一个数组
int (*a)[10];//表示指针指向一个int型的长度为10的数组
**(3)函数指针:**指针指向一个函数
void (*a)();//表示指针指向一个无参数无返回值的函数
指针的引用:指针引用后得到的是该地址所对应的变量的值。
二级指针:指向一级指针地址的指针
指针的运算:
(1)指针+或者-一个数,表示指针加减这个数的类型所占内存的整数倍
如 int *p=a;
p=p+2; // 在VC6.0里面,实际上p加了2 * 4=8
(2)指针减去一个指针,表示两个指针之间所差的内存单元或者元素个数,两个指针相加没有意义
(3)关系运算,如果定义了两个指针变量p和q,并且都已经初始化了,
如果p==q,则表示p和q指向同一个地址
p>q,则表示p指向高地址而q指向低地址
也经常拿p和NULL做比较,用来表示指针当前的状态,这在数据结构中应用非常广泛,不如说链表的查找等等
指针和数组的关系:
指针和数组关系密切,数组可以通过指针去引用,数组可以存放指针,数组也可以由指针去访问,指针也能存放数组的地址