本帖最后由 black747521 于 2015-11-5 19:59 编辑
#include <stdio.h>
int main(int argc, const char * argv[]) {
//定义二维数组arr int arr[3][3]={1,2,3,4,5,6,7,8,9}; //定义指针数组p[3],该指针数组存放的是每一个元素是一个数组指针 int *p[3]={arr[0],arr[1],arr[2]}; // p = arr = &arr[0] = &p[0] //p+1 = arr+1 = &arr[1] = p[1] //p+2 = arr+2 = &arr[2] = p[2] printf("%d\n",**arr); //1 printf("%d\n",**p); //1 printf("%d\n",*p[0]); //1
printf("%d\n",**(arr+1)); //4 printf("%d\n",**(p+1)); //4 printf("%d\n",*p[1]); //4 7同理
printf("%d\n",*((*arr)+1)); //2 printf("%d\n",*(*(p)+1)); //2 printf("%d\n",*(p[0]+1)); //2
printf("%d\n",*(*(arr+1)+1)); //5 printf("%d\n",*(*(p+1)+1)); //5 printf("%d\n",*(p[1]+1)); //5
|