The latest version of this topic can be found at Additional Termination Considerations.
You can terminate a C++ program by using exit, return, or abort. You can add exit processing using the atexit function. These are discussed in the following sections.