I have seen many posts regarding this question. Many say that exit(EXIT_SUCCESS)
should be called for successful termination, and exit(EXIT_FAILURE)
for unsuccessful termination.
- What I want to ask is: What if we do not call the
exit()
function and instead what if we writereturn 0
orreturn -1
? What difference does it make? What happens if successful termination does not happen? What are its effects?
It is told that if we call
exit()
functions the program becomes portable -- "portable" in the sense what? How can one function make the entire code portable?It is told that the execution returns to the parent what happens if the execution does not return to the parent?
My questions may seem to be silly but I need answers for all of these to get rid of my ambiguity between return and exit.