In my code I have to use a function that accepts a double*
as an argument
void function_1(int a, double* var){
(*var) = 0.;
for (int i=0; i<a.Size(); i++) {
(*var)+=pow(a[i],2);
}
(*var) = (*var)/a.Size();
}
Then I have to use (*var)
in another function that needs var as a double
double function_2(double x)
I tried to use
function_2( *(double*) var )
but without any success... Since I am new to c++
I think I am doing something fundamentally wrong. Any help on that?
Aucun commentaire:
Enregistrer un commentaire