title: exit() or _exit()?
body: <p>Consider this snippet of code:</p>
  
  <pre><code>void do_child(void);
  
  int main(void){
  int n;
  pid_t child;
  printf("Write a number: ");
  scanf("%d", &amp;n);
  if(n != 1){
  exit(1);
  }
  child = fork();
  if(child &gt;= 0){ /* fork ok */
   if(child == 0){
      printf("Child pid: %d\n", getpid());
      do_child();
      _exit(0);
    }
   else{ /* parent */
      printf("Child parent: %d\n", getpid());
      _exit(0);
   }
  }
  else{ /* fallito */
      perror("No fork");
      return 1;
  }
  return EXIT_SUCCESS;
  }
  
  void do_child(void){
  /* some code here */
  if(1 != 1){
      /* what to write here?? _exit or exit*/
  }   
  }
  </code></pre>
  
  <p>When exiting from a child process it is best to write <code>_exit</code> instead of <code>exit</code> but if i need to call an external function and into this function i want to put an exit, what should i write? <code>_exit</code> or <code>exit</code>?</p>