6.15 the exit function
what file header must be used with an exit function?
<cstdlib>
why should we use exit function with caution?
because it shuts down your whole program.
when the exit function is called what happens?
it cause the program to stop regardless of which function contains the call.
a C++ program stops executing when the return statement in function main is encountered. when other functions end, however, the program does not stop. Control of the program goes back to the place immediately following the function call.
sometimes rare circumstances make it necessary to terminate a program in a function other than main. to do this we use the exit function.
exit (0) is what?
the exit function used inside a function to stop the program.
concept the exit function:
the exit() function cause a program to terminate, regardless of which function or control mechanism is executing.