C++ Primer book i read says that
The value returned from main is accessed in a system dependent manner. On both UNIX and Windows systems, afar executing the program you must issue an appropriate echo command. On UNIX we obtain the status by echo $?
So, if the program is
int main ()
{
return -88;
}
Why does echo $? not return it? (168 is printed upon echo)
It does, sort of. It'll convert the value to an unsigned 8-bit value, though, which is 256 − 88 = 168. That's part of the system-dependent mannerism.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With