二维数组指针问题
##include<stdio.h>
int main()
{
int a[3][1] = {
{1},{2},{1}
};
int(*pa)[1] = a;
printf("%d\n", pa);
char c[3][1] = {
{'A'},{'S'},{'A'}
};
char(*pc)[1] = c;
printf("%d\n", pc);
char b[3][10] = {
{"AAA"},{"SAAAA"},{"RSS"}
};
char(*pb)[10] = b;
printf("%s\n", pb);
printf("%s\n", pb+1);
printf("%s\n", pb + 2);
printf("%d\n", pb);
printf("%d\n", *(pb)+1);
printf("%d\n", pb + 1);
printf("%d\n", pb + 2);
printf("%s\n", *(pb)+10);
printf("%s\n", *(pb)+11);
printf("%s\n", *(pb)+12);
printf("%s\n", *(pb)+20);
printf("%c\n", **(pb));
printf("%c\n", *(*(pb)+1));
printf("%c\n", *(*(pb)+2));
printf("%c\n", *(*(pb)+10));
printf("%c\n", *(*(pb)+11));
printf("%c\n", *(*(pb)+12));
printf("%c\n", *(*(pb)+13));
printf("%c\n", *(*(pb)+14));
printf("%c\n", *(*(pb)+20));
}
根据代码 printf("%d\n", pb); printf("%d\n", pb + 1);
printf("%d\n", pb + 2); 我猜此处 pb 仍为地址,但是printf("%s\n", pb);打出来的是内容,是否说明printf("%s\n", pb);可直接根据首地址打出内容,因为我试了下printf("%c\n", (pb));是不可以的,想要打出指针的内容还是需要printf("%c\n", **(pb));