当前位置:网站首页>特殊指针的一些应用
特殊指针的一些应用
2022-07-17 05:08:00 【学会放下ta】
特殊指针
指针和多维数组
指针索引和数组下标索引作用相同
int a[2][3]={
{
1,2,3},
{
4,5,6}};
int (*p)[3] = a;
则a[1][2]==*(*(a+1)+2)==*(*(p+1)+2)==6
void指针
void指针可以指向任意数据类型,可以用来在任意类型指针之间转换,但是不能直接对void指针解引用。
int a = 110;
int *pa = &a;
char *b = 'bbb';
void p;//报错,不能用void 定义变量
void *p;
p = pa;
printf("%d\n",*p);//报错,不能对void指针进行解引用
printf("%d\n",(int *)p);//ok
p = b;
printf("%s\n",p);//ok
NULL指针
当你不清楚你的指针要指向那里时,请把它初始化为NULL
int *p = NULL;
边栏推荐
猜你喜欢

mysql的锁

【全网首发】主线程异常会导致 JVM 退出?

Redis source code analysis dynamic string implementation (SDS)

Online software testing training institutions lemon class and itest AI platform achieves strategic cooperation

Cesium 綁定鼠標事件和移除鼠標事件

用Flink SQL流化市场数据2:盘中风险价值

C语言文件的操作

mysql的事务

Solutions for vscode terminal failure

redis 源码分析 动态字符串实现(sds)
随机推荐
线上软件测试培训机构柠檬班与iTest.AI平台达成战略合作
Opendds QoS and custom QoS (timing, timingqospolicy)
[ES6] use multiple functions such as adding data, filtering and transmitting to the page to realize cases
Cesium BIND Mouse Events and remove Mouse Events
使用Flink SQL传输市场数据1:传输VWAP
Excel imports long data and changes to 000 at the end
From 20s to 500ms, I used these three methods
Swagger configuration and use
Easypoi之excel多sheet导入
操作系統常見面試題
Distributed registry etcd
Nacos配置管理
STL container -- basic operation of map
Online software testing training institutions lemon class and itest AI platform achieves strategic cooperation
父组件加scoped有时也会影响子组件
Single arm routing configuration
Questions d'entrevue courantes du système d'exploitation
Easypoi之excel模板导出
Redis 源码分析-数据结构及实现(字典dict)
2020-11-10