Sorry, I donโt see the question here ... but I can guess what interests you.
printf () is a stateful function, so it is not reentrant. It uses the FILE structure (the variable name is "stdin") to save its state. (This is similar to calling fprintf (stdin, format, ...)).
This means that depending on the implementation and โgood luckโ, calling printf () from the signal handler may print what you expect, but it may also not print anything, or even not crash, or worse, crash the memory! Everything can happen.
So, just do not call functions from the signal handler that are not explicitly marked as "safe for the signal." In the long run, you will avoid a lot of headaches.
source share