title: What is the valid range for program return value in Linux/bash?
body: <p>I have a C program which returns an integer value. I was surprised to find out that when examining the return value from the shell prompt I get the value modulo 256.</p>
  
  <pre><code>/* prog.c */
  int main(...) { return 257; }
  </code></pre>
  
  <p>--</p>
  
  <pre><code>&gt; ./prog.e
  &gt; echo $?  
  1
  </code></pre>
  
  <ul>
  <li>Why don't I see the whole integer?  </li>
  <li>Where is this behavior documented?  </li>
  <li>How can I get the whole 32-bit value to the shell?</li>
  </ul>