dereferencing function pointer to function returning void throws error: void value not ignored as it ought to be

Solution 1:

This expression statement

*recurse(2); 

is equivalent to

*( recurse(2) ); 

So as the return type of the function is void then you are trying to dereference the type void.

It seems you mean

( *recurse )(2); 

Or you could just write

recurse(2); 

because the expression *recurse used in the first call will be again implicitly converted to a function pointer.

So though this call for example

( ******recurse )(2); 

is correct nevertheless dereferencing the pointer expressions are redundant.