title: How do you kill zombie process using wait()
body: <p>I have this code that requires a parent to fork 3 children. </p>
  
  <ul>
  <li><p>How do you know (and) where to put the <strong>"wait()"</strong> statement to kill<br>
  zombie processes?</p></li>
  <li><p>What is the command to view zombie processes if you have Linux
  virtual box?</p>
  
  <pre><code>main(){
  
   pid_t child;
   printf("-----------------------------------\n");
   about("Parent");
   printf("Now ..  Forking !!\n");
   child = fork();
   int i=0;
  
   for (i=0; i&lt;3; i++){
      if (child &lt; 0) {
          perror ("Unable to fork");
          break;
      } 
      else if (child == 0){
          printf ("creating child #%d\n", (i+1));
          about ("Child");
          break;
      }
  
      else{
          child = fork();
      }
    } 
  }       
  
  void about(char * msg){
  
   pid_t me;
   pid_t oldone;
  
   me = getpid();
   oldone = getppid();
  
   printf("***[%s] PID = %d   PPID = %d.\n", msg, me, oldone);
  
  }
  </code></pre></li>
  </ul>