Often I find the need to write functions which return function pointers. Whenever I do, the basic format I use is:
typedef int (*function_type)(int,int);
fu
ill leave this here since it was a bit trickier than answers already given, as it takes a function pointer
(int (__cdecl *)(const char *))
and returns a function pointer
(int (__cdecl *)(const char *))
#include
int (*idputs(int (*puts)(const char *)))(const char *) {
return puts;
}
int main(int argc, char **argv)
{
idputs(puts)("Hey!");
return 0;
}