What is the difference between exit and return?
return returns from the current function; it’s a language keyword like for or break. exit() terminates the whole program, wherever you call it from. (After flushing stdio buffers and so on). The only case when both do (nearly) the same thing is in the main() function, as a return from main performs an exit(). In … Read more