C语言编程:求double型二维数组a的最大值和最小值;急要,能把程序写全最好,谢谢

2024-11-24 04:08:28
推荐回答(1个)
回答1:

double fmax(double a[][m],int n,double *pmin) { // m必须是常量
int i,j;
double max;
max = *pmin = a[0][0];
for(i = 0; i < n; ++i) {
for(j = 0; j < m; ++j) {
if(max < a[i][j]) max = a[i][j];
if(*pmin > a[i][j]) *pmin = a[i][j];
}
}
return max;
}