Right.
"i' needs to be an integer. Sum should be an integer when you are adding integers, but a double when you are adding doubles.
"ave" definitely should be a double.
Type: Posts; User: Adak
Right.
"i' needs to be an integer. Sum should be an integer when you are adding integers, but a double when you are adding doubles.
"ave" definitely should be a double.
//this is what i'm doing now
double theAverage(double M[]){
double ave;
ave=(double)(M[0]+M[1]+M[2]+M[3]+M[4])/SIZE;
return ave;
}
Your array was a local or automatic variable, not a global one. So if you want the other functions to work with the array, you need to tell them where they can find it (an address, which is what a...
#include<stdio.h>
#include<stdlib.h>
#define SIZE 5
int largest(int *L){
int i,big;
big=L[0];
for (i=1;i<SIZE;i++){