My question is: is there a difference between the types/reference/pointer symbols for calling a function and the arguments in the function definition?
This question came up due to the following error I had:
myClass.cpp:358:44: error: no matching function for call to 'myClass::myFunction(double&, double&, double (*)[24], double (*)[30], int&)'
myClass.cpp:358:44: note: candidate is:
myClass.h:29:8: note: void myClass::myFunction(double&, double&, double**, double**, int&)
It is very weird that the compiler suggests that I should use double&
for the first argument, because in fact a give a variable that is just double
. Same for the second argument. But ok I can accept that... Why is the third and fourth argument not matching?
double a,b,c[24],d[30];
myFunction(a, b, &c, &d,e);
e
is a int
attribute of myClass
. The function is
void myClass::myFunction(double& a, double& b, double *c[24], double *d[30], int& e)