twitter
    Find out what I'm doing, Follow Me :)

What About The Exit(4) Statement?

Now to keep our promise about the exit(4) statement. Redisplay the file named special.c on your monitor. The last statement simply exits the program and returns the value of 4 to MS-DOS. Any number from 0 to 9 can be used in the parentheses for DOS communication. If you are operating in a BATCH file, this number can be tested with the "ERRORLEVEL" command. Note that these characteristics only apply to MS-DOS. Most compilers that operate in several passes return a 1 with this mechanism to indicate that a fatal error has occurred and it would be a waste of time to go on to another pass resulting in even more errors.

It is therefore wise to use a batch file for compiling programs and testing the returned value for
errors.