I am trying to get a function to call another function through a pointer, I have gone through some posts and have tried doing it but I keep getting errors. Print is the function that I want apply to call. Apply should print all the data when print is called.
I get the error: Variable has incompatible type void
void print(double x) //function I want to pass
{
cout << x << endl;
}
void apply(vector<double> data, void (*f)(double))
{ //function with pointer to other function print
for(int i = 0; i< data.sizeof(); i++)
f(data[i]);
}