double类型的矩阵 找最大值及所在位置 **要求用指针。
程序代码:
#include <stdio.h> #include <stdlib.h> void input(double *p,int nn,int mm)// double (*p)[nn*mm] { int i,j; for(i=0;i<nn;i++) { for(j=0;j<mm;j++) scanf("lf",*(p+i)+j); } } int fun(double *p,int nn,int mm,int xx,int yy) { double max=*p; int i,j; for(i=0;i<nn;i++) { for(j=1;j<mm;j++) { if((*(*(p+i)+j))>max) //??????????????????? error: invalid type argument of unary '*' (have 'double') { max=*(*(p+i)+j); //??????????????????? error: invalid type argument of unary '*' (have 'double') xx=i+1; yy=j+1; } } } return max; } int fun2(double *p,int nn,int mm,int xx,int yy) { double max=p[0][0];//?????????error: subscripted value is neither array nor pointer nor vector int i,j; for(i=0;i<nn;i++) { for(j=1;j<mm;j++) { if(p[i][j]>max) //?????????error: subscripted value is neither array nor pointer nor vector { max=p[i][j]; //?????????error: subscripted value is neither array nor pointer nor vector xx=i+1; yy=j+1; } } } return max; } int main() { int n,m; while(scanf("%d %d",&n,&m)!=EOF) { int x=0,y=0; double a[11][11]; input(a,n,m); //fun(a,n,m,x,y); printf("%.2f %d %d",fun(a,n,m,x,y),x,y); } return 0; }double类型的矩阵 找最大值及所在位置 error的地方都是怎么错的??