In C, when we want to define a function pointer for the following type of functions:
int f(int x, int y);
we define a function pointer variable as
int (*fp)(int, int);
My question is, what is the meaning of the following line in C (without *), because gcc, compile it without error
int (fp)(int, int);
thank you
int (fp)(int, int);
is a forward declaration of a function named fp
.
It doesn't declare or define a variable. It's like using parentheses around any other name, like for example (x) + (y)
.
In short, it's the same thing as
int fp(int, int);