First of all, please see:
Entry point — Wikipedia, the free encyclopedia.
Your question suggests that your concern is the return
int
value. Even if it is not the case, knowing what it does is something good to know.
This is mostly a matter of history. There is a tradition for entry-level functions to return 0 in all cases except the cases of abnormal termination. In all (or almost all) OS, there are the libraries uses to check up the status of the process. When a process is terminated, your code can read this value from the status. Also, when the application is executed synchronously in one or another kind of a batch file, the starting command can return this value, which can be assigned to some kind of the batch/script variable which can further be used, for example, to fork further execution. At the same time, this is just the tradition or culture, not any kind of standard. The tradition to return 0 is stable enough, and all other values are totally application-dependent; if they are essential, they can be described in application-specific documentation. If the entry point function used the return is void, 0 is still returned to the runtime system; this is the default.
With time, the importance of this technique goes down; most applications simply ignore the possibility to return anything. There are two important reasons for that: structural exception handling and then graphics UI, and, to certain extent, threading. The dreaded technique of returning "status" from the function is eliminated; using it would be just silly. Exceptions are much more powerful. Normally, all applications catch all exceptions in all threads and show much more informative diagnostics of the problems in the application itself. Throwing the exceptions into the runtime system, execution environment, is relatively rare, used only in the simplest application or are indicative of low-tech. Moreover, event-oriented UI applications (that means, nearly all of them, if you take only the decent ones) catch all exceptions in the UI main event and show the problem diagnostics immediately.
—SA