#include <stdlib.h>
int main()
{
//输出a[i][j]=对应值 *(*(p+i)+j)牢记
int a[3][4]={{1,2,3,4},{5,6,7,8},{9,10,11,12}},b[2]={1,2};
char str[]="I love you!";//str可直接printf输出,但是整形数组名不可,需要*a
char *p_str="I love you!";//相当于一个无名字符数组@,@[]="I love you!",char *p_str=@;
printf("%s\n",str);
printf("%s\n",p_str);
printf("C:%c\n",str[3]);
// printf("S:%s\n",str[3]); 错误
printf("PS:%s\n",p_str+3); //初始位置偏移
printf("PC:%c\n",p_str+3); //输出错误
int (*p)[4];//p指向一维数组(含4个元素)
int i,j;
p=a;
for(i=0;i<3;i++){
for(j=0;j<4;j++){
printf("a[%d][%d]=%d\t",i,j,*(*(p+i)+j));
//printf("a[%d][%d]=%d\t",i,j,*(*(p+i)[j])); 表达式不对
}
printf("\n");
}
printf("%d\n",*(b+1));
printf("%d\n",*(*(a+1)+2));
return 0;
}
08-25
70
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
05-01
625
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
02-22
2173
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)