Are these 2 lines of code the same ??
line 1:
void (**foo)(int)
line 2
void *(*foo)(int)
Kindly help me understand on what is happening.
They are not the same.
void (**foo)(int);
foo is a pointer to a pointer to a function that takes an int parameter and returns void.
void *(*foo)(int):
foo is a pointer to a function that takes an int parameter and returns a pointer to void.
Postfix operators like () and [] have higher precedence than unary *, so
T *a[N]; // a is an array of pointer to T
T (*a)[N]; // a is a pointer to an array of T
T *f(); // f is a function returning pointer to T
T (*f)(); // f is a pointer to a function returning T
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With