title: The behavior of the fork() system call on Linux in this code
body: <p>I have read in books and online resources that the fork() system call creates a copy of current process and both the processes start executing from the point after the fork() system call is made. Is it correct?</p>
  
  <p>If it is correct then why does the code below print "Test Test"? It should print "Test" just one time (by the parent process).</p>
  
  <pre><code>#include &lt;sys/types.h&gt; /* pid_t */
  #include &lt;sys/wait.h&gt;  /* waitpid */
  #include &lt;stdio.h&gt;     /* printf, perror */
  #include &lt;stdlib.h&gt;    /* exit */
  #include &lt;unistd.h&gt;    /* _exit, fork */
  
  
  int main(void)
  {
      int ctr =1;
      int pc = 1;
      printf("%s", "Test ");
      pid_t pidmain = fork();
      return EXIT_SUCCESS;
  }
  </code></pre>