27/08/2011 @17:25:34 ^17:41:08

You Just Nest It

	void (*f)(void);

This is a pointer to a function that doesn't return anything.

What if I want to make a function that takes no argument and returns such a pointer?

Let's call it getfunc, and suppose it takes no argument itself (so it's basically getfunc(void))

As the title suggests, you just nest it. See the f:

	void (* f )(void);

f is a variable of the type you want the function to return. So, replace f with the function.

	void (*getfunc(void))(void);

I've always wondered how you do that without typedefs. I always had this idea it was impossible, for some reason.

source