title: Fork - How does both the parent and child run even though it's an if else
body: <p>Question A:</p>
  
  <p>Given the code below, I understand that when you call a fork, most if its resources are passed  over to the child process. Now just about every Fork example I have looked up is set up like the one I have. From the looks of it, I don't understand how the parent process is ever called since it's in the else block.   </p>
  
  <p>Question B:</p>
  
  <p>After the code in the child proces is executed, does it automatically know that it has to enter the parent process now? I have seen a wait(NULL) in other examples as well, what is the role of that wait if it is going to be entering the else block anyways. Suppose I want to execute two child processess of the same parent, would these two be running in parallel, and then running the code of the parent once it is done? Thanks.   </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;unistd.h&gt; 
  
  int main()
  {
          pid_t pid;
          pid = fork();
  
          if(pid == 0){
                  printf("Hello World");
          }
          else{
                  printf("Hello World");
          }
          return 0;
  }
  </code></pre>