CodePudding user response:
For example5 # define M
# define N 6
Void fun (int t [M] [N], int p [N])
{
Int r, c, m;
For (c=0; C{
M=t [0] [c];
For (r=1; R{
If (t [r] [c]{
M=t [r] [c];
}
}
P=m [c];
}
}
Int main ()
{
Int r, c, t [M] [N]={0}, p={0} [N].
For (r=0; r{
For (c=0; C{
The scanf (" % d ", & amp; T [r] [c]);
}
}
Fun (t, p);
For (c=0; CPrintf (" % d ", p [c]);
return 0;
}
CodePudding user response:
A one-dimensional array to use the first line of the two-dimensional array populated, and fixed n a good
# include & lt; stdio.h>
# define M 5
# define N 6
Void fun (int t [M] [N], int p [N]) {
Int I=0, j=0;
for(i=0; IP=t [0] [I] [I];
}//assignment, if you will be a pointer can point to the first line directly
for(j=0; Jfor(i=0; I If (p [j] & gt; [I] [j])=t
{
P=t [j] [I] [j];
}
}
}
}
Int main () {
int i=0; Int j=0;
Int t [M] [N]={};
Int [N] p={};
for(i=0; Ifor(j=0; J The scanf (" % d ", & amp; T [I] [j]);
}
}
Fun (t, p);
for(i=0; IPrintf (" % d ", p [I]);
}
printf("\n");
return 0;
}
Upstairs directly define m is also a principle, that is, to the back of the comparison