I understand if I write a bash script I can get the return value, but is there anyway to get the return value without scripting, and just command line?
Yes, the same way you'd do in a Bash script. Run your program like this:
./your_program; echo $?
In light of the invalidation of the previous answer (good point, Carl Norum), let me re-phrase my comment as an answer:
BASH stores the return value of the previously run command in the variable $?
. This is independent of the programming langauge used to write said command (the command can also be a shell internal).