#include
void fun(int **a, int NR, int NC, int *da, int *xiao, float *av){
int i,j;
*da = a[0][0];
*xiao = a[0][0];
*av=0;
for (j=0;j
if (*da if (*xiao > a[j][i]) *xiao = a[j][i];
*av= *av+a[j][i];
}
*av = (*av /NR) /NC;
}
int main(){
int **a;
int NR=4,NC=5;
int i,j;
int da,xiao;
float av;
a = (int **) malloc(sizeof(int *) * NR);
for (j=0;j
}
printf("input %d x %d array data:\n",NR,NC);
for (j=0;j
}
fun( &a[0], NR, NC, &da, &xiao, &av);
printf("max=%d min=%d mean=%g\n",da,xiao,av);
return 0;
}
例子:
input 4 x 5 array data:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
max=20 min=1 mean=10.5