#include <stdio.h>
int main(void) {
char s[][10]={"String1","String2"};
char (*p)[10]=s+1;
printf("%s\n",p);
printf("%s\n",*p);
return 0;
}
输出
String2
String2
/usercode/file.cpp: In function ‘int main()’:
/usercode/file.cpp:6:17: warning: format ‘%s’ expects argument of type ‘char*’, but argument 2 has type ‘char (*)[10]’ [-Wformat=]
printf("%s\n",p);
^