二维数组的应用 a[2][3]->b[3][2]
作者:互联网
int a[2][3];
int b[3][2];
for (int i = 0; i < 2; i++)
{
for (int j = 0; j < 3; j++)
{
scanf("%d", &a[i][j]);
}
}
printf("arry a[2][3]:\n");
for (int i = 0; i < 2; i++)
{
for (int j = 0; j < 3;j++)
{
printf("%d ", a[i][j]);
}
printf("\n");
}
for (int i = 0; i < 2; i++)
{
for (int j = 0; j < 3; j++)
{
b[j][i] = a[i][j];
}
}
printf("arry b[3][2]:\n");
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 2; j++)
{
printf("%d ", b[i][j]);
}
printf("\n");
}
标签:数组,int,scanf,++,二维,应用,printf,arry 来源: https://www.cnblogs.com/wang-xiao-shuai/p/15502936.html