title: Why does this program with fork print twice?
body: <p>According to my understanding of <code>fork()</code>, this should print "Hello, World!" once, since there is only one process before <code>fork</code> is called. However, it prints twice. Curiously, if I add a <code>\n</code> to the string or use <code>puts()</code> instead of <code>printf()</code>, it only prints once.</p>
  
  <pre><code>#include&lt;unistd.h&gt;
  #include&lt;stdio.h&gt;
  
  int main() {
      printf("Hello, World!");
      fork();
  }
  </code></pre>