I was trying to declare a function that takes a function of the same type as parameter.
void rec(void(*f)(void(*)(void(*)(...))))
{
f(f);
}
I ended up making a recursive attempt.
You can always cast from a void*
.
void rec(void* f)
{
((void(*)())f)(f);
}
But it's not type safe
I attempted to do this with a typedef
:
typedef void(*RecFunc)(RecFunc);
But doesn't compile.
Is it possible to do it?