title: Why does wait() set status to 255 instead of the -1 exit status of the forked process?
body: <p>I'm trying to return an integer value from a child process.</p>
  <p>However, if I use <code>exit(1)</code> I get <code>256</code> as the output from <code>wait()</code>. Using <code>exit(-1)</code> gives <code>65280</code>.</p>
  <p>Is there a way I can get the actual int value that I send from the child process?</p>
  <pre><code>if(!(pid=fork()))
  {
      exit(1);
  }
  waitpid(pid,&amp;status,0);
  printf(&quot;%d&quot;,status);
  </code></pre>
  <p><strong>Edit:</strong> Using <code>exit(-1)</code> (which is what I actually want) I am getting 255 as the output for <code>WEXITSTATUS(status)</code>. Is it supposed to be unsigned?</p>