It's a status code. The convention is that returning 0 means success, and non-zero means there was an error. It's up to you which number to use to represent different errors (you'll often see a program's documentation tell you how to interpret the different status codes). This is useful if somebody wants to call your program as part of a script - then they can check if your program succeeded and decide whether or not to proceed.