21、二维数组行列转换

#include <stdio.h>
int main()
{
   int a[2][3] ={1,2,3,4,5,6};
   int b[3][2];
    
   printf("原来的数组
");
   for(int i=0;i<2;i++){
       for(int j=0;j<3;j++){           
               printf("%d ",a[i][j]);
            b[j][i]=a[i][j]; 
       }
       printf("
");
   }
   // 输出新的数组
     printf("新的数组
");
     for(int i=0;i<3;i++){
       for(int j=0;j<2;j++){          
               printf("%d ",b[i][j]);
           
       }
       printf("
");
   }
   return 0;
}
原文地址:https://www.cnblogs.com/guojiusong/p/8031186.html