C Interview Questions and Answers

 

Is exit(status) truly equivalent to returning the same status from main?

Yes and no. The Standard says that a return from the initial call to main is equivalent
to calling exit. However, a return from main cannot be expected to work if data
local to main might be needed during cleanup; A few very old, nonconforming systems
may once have had problems with one or the other form. (Finally, the two forms are
obviously not equivalent in a recursive call to main.)

Posted by:Richards