Here is the right way to do this:
int (*(*b)(int,int))(int,int);
You can compile the following code demonstrating the use of both methods. I would personally use the typedef method for clarity.
#include <stdio.h> int addition(int x,int y) { return x + y; } int (*test(int x, int y))(int,int) { return &addition; } typedef int (*a)(int, int); int main() { a (*b)(int,int); int (*(*c)(int,int))(int,int); b = &test; c = &test; printf(b == c ? "They are equal!\n" : "They are not equal :(\n"); }
source share