Please explain this type signature : void (*signal(int signo, void *(func)(int)))(int)
The type signature of the signal
function is a bit more clear when a typedef is used for the function pointers that are passed around:
typedef void (*sighandler_t)(int);
sighandler_t signal(int signo, sighandler_t func);
sighandler_t
is a pointer to a function that takes an int
parameter and returns nothing. The signal
function takes such a function pointer as its second parameter. It also returns a function pointer of that type.
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