#include<stdio.h> void main(){ int a[3][4] = {{0,1,2,3},{4,5,6,7},{8,9,10,11}}; int b[4][3],i,j; printf("array a:\n"); for(i = 0; i <= 2; i++){ for(j = 0; j <= 3; j++){ printf("%4d",a[i][j]); b[j][i] = a[i][j]; } printf("\n"); } printf("array b: \n"); for(i = 0; i <= 3; i++) { for(j = 0; j <= 2; j++) { printf("%4d", b[i][j]); } printf("\n"); } }
运行结果如下: