Program Termination Normal Termination A process terminates normally when the program calls exit . Returning from main is equivalent to calling exit , and the value that main returns is used as the argument to exit . The exit function terminates the process with status status . This function does not return. Typically, this is used to do things like saving program state information in a file, or unlocking locks in shared data bases.
All open streams are closed, writing out any buffered output data.
See Closing Streams . See Termination Internals .