title: Regarding wait in Linux C programming
body: <p>I was given this code to run on Linux and its output was </p>
  
  <pre><code> S=512 P=0
  </code></pre>
  
  <p>I didn't understand why when we passed the memory address of the variable S to exit, it became a multiple of 256*S. </p>
  
  <p>A few experiments I tried: I set S=1 and the output was 256, I entered S=256, the output was S=0 and when I entered S=-1, the output was 256*255</p>
  
  <p>Note: I am used to C++ and haven't used C much.</p>
  
  <pre><code> int s=2, p=fork();
  
    if (p) {
  
      p -= wait(&amp;s);
  
          printf("s=%d p=%d\n", s, p);
  
    }
  
    else
  
          exit(s);
  </code></pre>