how can i chang a datatype int into float in the middle of a function that uses arrays?
my func is
[CODE=txt]
int avrg(int x[],int y)
{
int counter;
float average,sum=0;
for(counter=0;c ounter<y;counte r++)
sum+=x[counter];
float counter;
average=sum/counter;
return average;
}
[/CODE]
in this func i want to change the counter which is int into float after the expression
sum+=x[counter] in order to get the average in correct decimal places!!!
please help ASAP!!!!
my func is
[CODE=txt]
int avrg(int x[],int y)
{
int counter;
float average,sum=0;
for(counter=0;c ounter<y;counte r++)
sum+=x[counter];
float counter;
average=sum/counter;
return average;
}
[/CODE]
in this func i want to change the counter which is int into float after the expression
sum+=x[counter] in order to get the average in correct decimal places!!!
please help ASAP!!!!
Comment