教学内容: 以多维数组的形式访问动态内存 六、作业 1、int (*pNum)[3]=(int (*)[3]) malloc(24*sizeof(int)); 以 pNum[8][3]形式访问内存空间. //8*3 [8][3] int (*pNum)[3]; int i,j,n; n=1; pNum=(int (*)[3])malloc(24*sizeof(int)); for (i=0;i<8;i++) for (j=0;j<3;j++) { pNum[i][j]=n++; } //读取多维数组的值 for (i=0;i<8;i++) for (j=0;j<3;j++) { printf("%d,",pNum[i][j]); } //三维数组 //8*3 [8][3] //10*3*4 int (*pNum)[3][4]; int i,j,k,n; n=1; pNum=(int (*)[3][4])malloc(122*sizeof(int)); for (i=0;i<10;i++) for (j=0;j<3;j++) for(k=0;k<4;k++) { pNum[i][j][k]=n++; } // ////读取多维数组的值 for (i=0;i<10;i++) for (j=0;j<3;j++) for(k=0;k<4;k++) { printf("%d,",pNum[i][j][k]); }