The f parameter is a pointer to a function in both derivative and newton_raphson .
double derivative(double f(double), double x) { ... }
exactly equivalent
double derivative(double (*f)(double), double x) { ... }
Only, the first one looks better - usually when you can skip parentheses, you probably should do this. In the end, both are equivalent.
double ((((derivative)))(double (((*(f))))(double ((trouble))), double ((x)))) { ... }
I hope that it will be used only in IOCCC.
However, if you declare by defining a variable (not a function parameter), you need to use
double (*f)(double);
as
double f(double);
is just a function declaration.
6.7.6.3 The declaration of functions (including prototypes) of the C11 draft n1570 project states:
Declaring a parameter as a function '' return type should be adjusted to a "pointer" to the return function type, as in 6.3.2.1.
A 6.9.1 Function definitions further say that
[...] the type of each parameter is configured as described in 6.7.6.3 for the list of parameter types; the resulting type must be a full object type.
Additionally has the following example:
EXAMPLE 2
To pass one function to another, we can say that
int f(void); g(f);
Then the definition of g can read
void g(int (*funcp)(void)) { }
or, equivalently,
void g(int func(void)) { func(); }