What's the differences between exit(0), exit(1) and exit(-1)?

The paramarater is the value that the program will return to the operating system so that other programs can use it for some purpose. The value 0 traditionally means the program exits normally without error. Any other value would mean the program encountered some kind of error. The value of the parameter to exit() can be anything you want, its not limited to the three that you posted.

Exit(0) , is commonly used as a successful exit message. Usually, you don't use it, use instead Return 0; Exit(1) Is used to reference some kind of abnormal program termination.

>>Usually, you don't use it, use instead Return 0;

Unless, of course, exit() is used outside main().