title: parent process does not wait for the child process (c code)
body: <pre><code>char array[ARRAY_SIZE];
  
  void child_process_routine(){
  int j;
      for(j = 0;j&lt;ARRAY_SIZE;j++)
      array[j]='d';
  }
  
  main()
  {
      pid_t child_pid;
      int i;
      for(i = 0;i&lt;ARRAY_SIZE;i++)
      array[i]='c';
      child_pid = fork();
  
          switch (child_pid) {
          case -1:
              perror("error");    
              exit(1);
          case 0: 
              child_process_routine();
              exit(0);    
          default:
              wait(NULL);
          }
  
      print_array(array); 
  }
  </code></pre>
  
  <p>can you explain me why <strong>the parent process does not wait for the child process</strong> and this gives me the output " cccccc " again? it was changed in the child process into " dddddd "</p>
  
  <p>what does wait(NULL) even do?</p>
  
  <p>how does it supposed to know it should wait for the child process?</p>