The first response (by Mortissus) showed the way: the argument is a pointer to a function.
Originally Posted by Signifier
Once you figure out the syntax of the declaration, it's easy: just use the name of the function in the argument list, since the name of the function by itself is treated as "pointer to function".
Maybe something like this would meet your needs:
The first argument of simp() is a pointer to a function. That function is of type "double" and has a single argument, which is a double.
double simp(double (*f)(double), double start, double end, int steps);
double g(double x);
double first = 0.0;
double last = 1.0;
int NumberOfIntervals = 10;
value = simp(g, first, last, NumberOfIntervals);
cout << "value = " << value << endl;
// This is the user-defined function to be integrated
double g(double x)
// Use simpson's rule to approximate the integral from
// start to end, using steps
double simp (double (*f)(double), double start, double end, int steps)
// Simpson's rule here