原来这个指针是这么个意思
程序代码:
#include<stdio.h> void change(int(*p1)[3], int(*p2)[3]) { int i, j; for (i = 0; i < 3; i++) for (j = 0; j < 3; j++) *(*(p2 + j) + i) = *(*(p1 + i) + j); } void print(int(*p)[3]) { int i, j; for (i = 0; i < 3; i++) { for (j = 0; j < 3; j++) printf("%d ", *(*(p + i) + j)); printf("\n"); } } int main() { void change(int(*p1)[3], int(*p2)[3]); void print(int(*p)[3]); int a[3][3] = { {0,1,2},{3,4,5},{6,7,8} }; int b[3][3]; int(*x1)[3], (*x2)[3]; x1 = a; x2 = b; change(x1, x2); print(x2); return 0; }