深刻理解数组指针(就是一个指针)
Posted limouren
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了深刻理解数组指针(就是一个指针)相关的知识,希望对你有一定的参考价值。
明白了这段代码,对数组指针理解的已经非常透彻了
char arr[]={
0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x07,0x09,
0x00,0x20,0x10,0x03,0x03,0x0C,0x00,0x00,0x44,0x00,
0x00,0x33,0x00,0x47,0x0C,0x0E,0x00,0x0D,0x00,0x11,
0x00,0x00,0x00,0x02,0x64,0x00,0x00,0x00,0xAA,0x00,
0x00,0x00,0x64,0x10,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x02,0x00,0x74,0x0F,0x41,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x0A,0x00,
0x00,0x02,0x74,0x0F,0x41,0x00,0x06,0x08,0x00,0x00,
0x00,0x00,0x00,0x64,0x00,0x0F,0x00,0x00,0x0D,0x00,
0x00,0x00,0x23,0x00,0x00,0x64,0x00,0x00,0x64,0x00
};
int (*px)[2]=(int (*)[2])arr;
int (*py)[2][3]=(int (*)[2][3])arr;
char (*pz)[2]=(char (*)[2])arr;
char (*pk)[2][3]=(char (*)[2][3])arr;
printf("%x\n",*(*(px+1)+0));
printf("%x\n",*(*(px+2)+0));
printf("%x\n",*(*(px+3)+3));
printf("%x\n",*(*(*(py+2)+2)+3));
printf("%x\n",*(*(pz+1)+3));
printf("%x\n",*(*(*(pk+1)+2)+4));
以上是关于深刻理解数组指针(就是一个指针)的主要内容,如果未能解决你的问题,请参考以下文章