What does a typedef with parenthesis like “typedef int (f)(void)” mean? Is it a function prototype?

It’s a typedef to a function type. The intent is to use it for function pointers, but in this case the syntax to use it would be:

int bar(void);

fc_name* foo = bar; /* Note the * */

Update:
As mentioned in the comments to Jonathan Leffler’s answer, the typedef can be used to declare functions. One use could be for declaring a set of callback functions:

typedef int (callback)(int, void*);

callback onFoo;
callback onBar;
callback onBaz;
callback onQux;

Leave a Comment