程序如下,编译得时候有错误原因为何?急切想知道答案。 main() { float average(float *p,int n); float search(float (*p)[4],int n); float score[3][4]= {{65.2,67.6,79,60},{80.8,87,90,81}, {90,99,100,98.9}}; average(*score,12);
search(score,2); }
float average(float *p,int n) { float *p_end, sum=0,aver; p_end=p+n-1; for(;p<=p_end;p++) sum=sum+(*p); aver=sum/n; printf("average=%f\n",aver); }
float search(float (*p)[4], int n) { int i; printf(" No.%d :\n",n); for(i=0;i<4;i++) printf("%.2f ",*(*(p+n)+i)); printf("\n"); }