# include & lt; stdio.h>
#include
#include
Void PrintArray (int arr [3] [3])//function 1: print the original matrix
{
int i,j;
for(i=0; i<3 I + +)
{
for(j=0; j<3; J++)
{
Printf (" % d ", arr [I + 1] [j + 1));
}
printf("\n");
}
}
Void TransArray (int arr [3] [3]) 2://function matrix transpose
{
int i,j;
for(i=0; i<3; I++)
{
for(j=0; j<3; J++)
{
Printf (" % d ", arr [j] [I]);
}
printf("\n");
}
}
Void main ()//main function
{
Int array [3] [3]={{1, 2, 3}, {2, 3}, {three, four, five}};
Printf (" transposed front: \ n ");
PrintArray (array [3] [3]).
Printf (" after the transpose: \ n ");
TransArray (array [3] [3]).
}
The result is like this:

Trouble help have a look, thanks!
CodePudding user response:
Print function, the printf () in the arr [I + 1] [m + 1] array subscript bounds, is directly I jCodePudding user response:
Upstairs said to, why should I + 1, j + 1CodePudding user response:
Main function calls in the written arguments wrong,PrintArray (array);//PrintArray (array [3] [3]).
CodePudding user response:
Above the first inside the for lack of a semicolon, impossible to compile, believed to be caused by careless operation when copying,CodePudding user response: