Returning function pointer type

int (*getFunc())(int, int) { … }

That provides the declaration you requested. Additionally, as ola1olsson notes, it would be good to insert void:

int (*getFunc(void))(int, int) { … }

This says that getFunc may not take any parameters, which can help avoid errors such as somebody inadvertently writing getFunc(x, y) instead of getFunc()(x, y).

Leave a Comment