看看这个程序符合你不?
#include<stdio.h>
#define M 3
#define N 4
void fun(int tt[M][N],int pp[N])
{
int i,j,min,temp;
int (*p)[N];
for(i = 0; i < N; i++)
{
min = *p[0];
for(p = tt,j = 0; j < M;j++)
{
if((*p)[i] < min)
{
min = (*p)[i];
}
p++;
}
pp[i] = min;
}
}
int main(void)
{
int t[M][N]={
{1,3,5,7},
{2,4,6,8},
{11,52,77,36}
};
int p[N],i;
fun(t,p);
for(i=0;i<N;i++) /*有四列所以有四个最小值,每列一个*/
printf("%3d",p[i]);
return 0;
}
#include<stdio.h>
#define M 3
#define N 4
void fun(int tt[M][N],int pp[N])
{
int i,j,min,temp;
int (*p)[N];
for(i = 0; i < N; i++)
{
min = *p[0];
for(p = tt,j = 0; j < M;j++)
{
if((*p)[i] < min)
{
min = (*p)[i];
}
p++;
}
pp[i] = min;
}
}
int main(void)
{
int t[M][N]={
{1,3,5,7},
{2,4,6,8},
{11,52,77,36}
};
int p[N],i;
fun(t,p);
for(i=0;i<N;i++) /*有四列所以有四个最小值,每列一个*/
printf("%3d",p[i]);
return 0;
}