//对任意有效整数的i,j, 使矩阵M[i][j] 转换为N[j][i]
#include <stdio.h>
int main(void)
{
void transposeMatrix ( int rows, int cols, int box[rows][cols]);//转换函数
int i, j, m, n;
int box1[m][n];
printf ("Enter your number for box1: \n");
scanf ("%i%i", &m , &n);//m*n的矩阵
for( i = 0; i < m; ++i)//输入box1的数据
for ( j = 0; j < n; ++j)
{
printf ("Enter your number: \n");
scanf ("%i", box1[i][j]);
}
for( i = 0; i < m; ++i)//打印box1的数据
for ( j = 0; j < n; ++j)
{
if ( j == (n-1) )
printf ("%3i\n", box1[i][j]);
else
printf ("%3i", box1[i][j]);
}
printf ("\n\n");
transposeMatrix ( m, n, box1);//调用函数
return 0;
}
int transposeMatrix (int rows, int cols, int box[rows][cols])
{
int i, j ;
for( j = 0; j < cols; ++j)//转换矩阵
for ( i = 0; i < rows; ++i)
box2[j][i] = box[i][j];
for( j = 0; j < cols; ++j)//打印矩阵
for ( i = 0; i < rows; ++i)
{
if ( i == (rows - 1) )
printf ("%3i\cols", box2[j][i]);
else
printf ("%3i", box2[j][i]);
}
return 0;
}
帮我看一下我的错误,我不知道错那里了?