What should I do to get the whole return value of c-program from command line? What should I do to get the whole return value of c-program from command line? unix unix

What should I do to get the whole return value of c-program from command line?


Exit codes on Unix are restricted to a single byte. If you want to output more, you could write it to stdout or to a file instead.

Then why does the C standard decree that main returns int and not char? I have no idea...


The value returned from main can be printed using echo $? after you are done with the execution. The return value from main is generally used to indicate the execution status.The max value is limited to 512. If you try to return a greater value than 512, 512%val would be set in $?.