Pointers

When i compile this this is the error msg i get
error: cannot convert 'double' to 'double' for arguement '2' to 'void findStatsAddr(double*, double*, doulbe*, double*)'

Can anyone help with this



//Function Prototype
void findStatsAddr(double Array[], double* sum, double* mean, double* median);

//function call
findStatsAddr(salesArray, sum, mean, median);

//Function
void findStatsAddr(double salesArray[], double* sum, double* mean, double* median)
{
double Array[NUM_MONTHS] = {0};

for (int index = 0; index < NUM_MONTHS; index++)
Array[index] = salesArray[index+1];

sortArray(Array)
cout << findSum(Array) << endl;
cout << findMean(Array) << endl;
cout << findMedian(Array) << endl
}
I think you have to read the compiler error message a bit more closely.
Does it say cannot convert double to double * for argument 2 ......

you are passing the wrong type. The function is expecting pointer to doubles.
yup thanks, i should have thought more about it.
I was puzzled by that at first too. You have to look closely as its easy to miss the

'*double' to 'double' for


Last edited on
Topic archived. No new replies allowed.