title: C programming error handling
body: <p>I want my code to be able to handle the error cases, such as unsuccessful return of functions. For instance,<code>pthread_create</code>,normally I use the function herebelow:</p>
  
  <pre><code>int thread_check1;
   pthread_t function;
   thread_check1 = pthread_create( &amp;function, NULL, function_function,  NULL);
  if(thread_check1 != 0){
     fprintf(stderr, "pthread_create error\n");
     exit(1);
  }
  </code></pre>
  
  <p>Considering the error cases, would it be correct to call the same function till it returns 0(for this specific function) as it is done below?</p>
  
  <pre><code>thread_check1 = pthread_create( &amp;function, NULL, function_function,  NULL);
  while(thread_check1 != 0){
      thread_check1 = pthread_create( &amp;function, NULL, function_function,  NULL);
  }
  </code></pre>
  
  <p>Can I apply the same logic to the other C functions that returns a value? Otherwise, how would you suggest to handle error cases (for the function returns) without exiting from the program? </p>