Possible Duplicate:
C declaration from standard signal Library
Here is a reference to the link for the syntax. I have only understood the syntax of a pointer to a function. But this is too complex please explain.
http://www.cplusplus.com/reference/clibrary/csignal/signal/
I am trying to understand the precise syntax given( some pointer confusion that I can’t resolve ).
signal()is pretty easy to understand here’s example code from the link I mentioned with my annotations:Now this code will loop forever (doing something), until it gets a ^C (ctrl+C) interrupt signal. At that point in time it will go do whatever it is we told it to do:
The signal function is defined as:
Which means:
Then at a system level, when our program is running, if a signal comes in and we have handling for it, we do so, if we don’t have handling in place, the OS takes a default action.
If you remove the signal call from my above example, you’ll see ctrl+C now kills the program instead of just allowing the signal handler to run.
Answer your question?