title: In a fork() program what is executed first? Parent or child?
body: <p>I don't know what is executed first in fork. For example I have this code:</p>
  
  <pre><code>int main() {
     int n = 1;
     if(fork() == 0) {
        n = n + 1;
        exit(0);
     }
     n = n + 2;
     printf(“%d: %d\n”, getpid(), n);
     wait(0);
     return 0;
  }
  </code></pre>
  
  <p>What will this print on the screen?</p>
  
  <pre><code>1: 3
  0: 4
  </code></pre>
  
  <p>or</p>
  
  <pre><code>0: 4
  1: 3
  </code></pre>