程序代码:
#include<stdio.h> int main() { void fun(int a[][3],int n,int m); void fun_2(int a[][3],int (*p)[3],int n,int m); int a[3][3]={1,2,3,4,5,6,7,8,9}; int (*p)[3]=a; int n=sizeof(a)/sizeof(a[0]); int m=sizeof(a[0])/sizeof(int); fun(a,n,m); fun_2(a,p,n,m); return 0; } void fun(int a[][3],int n,int m) { int i=0; int j=0; for (i=0;i<n;i++,printf("\n")) for (j=0;j<m;j++) printf("%3d",a[i][j]); } void fun_2(int a[][3],int (*p)[3],int n,int m) { int i=0; int j=0; for (i=0;i<n;i++,printf("\n")) for (j=0;j<m;j++) printf("%3d",*(*(p+i)+j)); }