Assuming you are talking about main()
function return value here, which becomes "the program exit status" (wiki link).
For GUI programs, the return value is rarely used for anything, be it programmer or user of the program.
On the other hand, for console programs and command line utilities, the return value is often very useful, sometimes even the whole purpose and only output of the program. Example is Unix test
utility. User uses it to test some condition, such as test -f file.txt
to test if file.txt exists. It will return exit code 0 (which generally means success) if file exists, non-zero if it does not.
Of course in these cases, user of the program is generally someone for example writing a shell script or command line "one-liner", but still they are users of the program, and won't be looking at the programs source code to use the program.
About C and standards: Note that C standard itself does not say much about what values main
can return, other than providing two constants EXIT_SUCCESS
(I think this is 0 always, but no standard reference handy) and EXIT_FAILURE
(which is then non-zero), and leaving rest for the implementation. But in MSDOS/Windows/Unix/Linux, you can basically provide an exit status at least in range 0-255, depending on OS a possibly much larger range also including negative values, and then use these to mean different things. From OS point of view, having 0 mean success is just a convention or recommendation, not really enforced in any hard way, and there it is up to the parent process to interpret the return value correctly.