in reply to Reading return value from C program

If you launched the program using system, the child's exit code is returned by system. It is also placed in $?. See the example in the docs on how to do error handling and on how to extract the exit code.

If the child was launched asynchronously, waitpid will place the exit code in $?.