Recursive declaration of function pointer in C

It’s not possible to do this in C: a function can’t return a pointer to itself, since the type declaration expands recursively and never ends. See this page for an explanation: http://www.gotw.ca/gotw/057.htm

The workaround described on the above page means returning void (*) () instead of the correctly-typed function pointer; your workaround is arguably a little neater.

Leave a Comment