title: How fork and pid (if (pid != 0)) work in this code?
body: <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;unistd.h&gt;
  
  int main()
  {
      int pid;
      int x, y;
  
      x = 10;
      y = 10;
      pid = fork();
  
      if (pid != 0)
      {
         x++;
         y--;
      }
  
      printf("x = %i y = %i\n", x, y);
  
      pid = fork();
  
      if (pid != 0)
      {
         x++;
         y--;
      }
      printf("x = %i y = %i\n", x, y);
  
      return (0);
  }
  </code></pre>
  
  <p>I am completely confused by this part of the code. Can anyone explain me how it works?
  Also I can't understand which process (child/parent) prints.</p>