主题:求助高手为何返回值是0
为何返回值是0了 谢谢各位高手啦
#include<stdio.h>
double average(int ary[ ]);
int main (void)
{
double ave;
int bace[5]={1,2,3,4,5};
ave=average(bace);
printf("Average is:%d\n",ave);
return 0;
} //main
double average(int ary[])
{
float sum;
int i;
for(i=0,sum=0;i<5;i++)
sum+=ary[i];
return(sum);
} //average
#include<stdio.h>
double average(int ary[ ]);
int main (void)
{
double ave;
int bace[5]={1,2,3,4,5};
ave=average(bace);
printf("Average is:%d\n",ave);
return 0;
} //main
double average(int ary[])
{
float sum;
int i;
for(i=0,sum=0;i<5;i++)
sum+=ary[i];
return(sum);
} //average