What is the Signal function (SIGINT)?

Amit Jain picture Amit Jain · Apr 30, 2013 · Viewed 17.8k times · Source

What does this statement below do? If anyone can explain this function I would really appreciate it.

signal(SIGINT, SIG_DFL);

Answer

Sandeep_black picture Sandeep_black · Mar 26, 2017

SIGINT is the interrupt signal (ctrl+C). Its default behaviour is to terminate the process. SIGINT signal can be dis-positioned, means one can change the default behaviour ( By calling sighandler, or setting it SIG_IGN ) Now once the action is changes and you want to set it again the default behaviour of this signal then you should write

signal(SIGINT, SIG_DFL);

It will again change the default behaviour of the signal. ( which is to terminate a process )