#include
#include
int main()
{
int fun(double score[],int m, double below[]);
double below[9];
int i, n;
double score[9]={10,20,30,40,50,60,70,80,90};
// clrscr();
n=fun(score,9,below);
printf("\nBelow the average score are:\n");
for(i=0;i printf("%.1lf ",below[i]); } int fun(double score[],int m, double below[]) { int i,j=0; double average=0.0; for(i=0;i average=average+score[i]; average/=m; for(i=0;i if(score[i] below[j++]=score[i]; return j; }
你这是要排序么?
嗯明显一个错误你的below[]只传了数值到double fun(xxx)这个函数,算是一个临时变量,在主函数中below[]的值是不会随你fun函数的操作而改变的。。想改的话要传指针哈