Does ctrl-c clear variables?

I could not find the answer to this anywhere:

Some variables need to be cleared (or something similar); dynamic arrays declared with new must be delete []ed, ofstreams must have .clear(), mpfr-variables must have mpfr.clear() and so on. When I use ctrl-c, are these implemented or does it mess up the memory or something?
ctrl-c has nothing whatsoever to do with the values of variables. It's a keyboard command and what it does will depend entirely on the OS and the program running.

If you're asking "what happens to my programs memory if I end the program suddenly" the answer is that in a modern system, the OS takes back all the memory and it's not something you have to worry about.
Last edited on
C++ objects rely on RAII* to clean up after themselves, but according to this article, destructors are not called by default:
http://stackoverflow.com/questions/4250013/is-destructor-called-if-sigint-or-sigstp-issued

*http://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization
Thank you! The second reply in the stack overflow thread sounds reassuring:
However, the operating system will reclaim any resources your program used when it terminates.
Topic archived. No new replies allowed.