The return value can be used outside the program by the caller program, script or command. Provided two programs:
the program
f1
int main(){return 0;}
and respectively
f2
int main(){return 1;}
If you call them like this, you get this output
f1 success
$ ./f1 && echo f1 success || echo f1 failure
When you call f2 in similar way the output is
f2 failure
$ ./f2 && echo f2 success || echo f2 failure
Above chaining is possible because of the return code, also exit code.
Invoke as
yourprogram && otherprogram if you want
otherprogram to be called when
yourprogram in case it finished successfully. Or call as
yourprogram && otherprogram if you want
otherprogram to be called when of failure of
yourprogram