views:

246

answers:

1

Please explain this type signature.

+12  A: 

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.

sth