Originally Posted by
matsp
What's not really explained in the FAQ is that the "void main()" construction is broken BECAUSE although you define the content of main, it is called by the startup code that sets up the entire C environment, and it also "finishes off" the C environment. In the finishing off process, it will set the "exit value" for the process - this is the return value from main(). If you use "void main()", the C environment will still think that main returns something, and take whatever "garbage" is where the return value should have been. This means that the exit value from your applicaiton is "undefined". Not only that, it may change if you recompile the program with some different compiler settings, change the code inside main [or some of the code called by main, depending on where the place that the return value from main is last used].