title: In C, can a function exit() or should it allow main() to handle that?
body: <p>I'm writing a C program, and I'm curious about something. The program has several functions that return 1 on success and 0 on failure, and most are called by <code>main()</code> (though some are called by other functions). This is for an assignment, and if an error is caught I need to print the error to <code>stderr</code> using <code>fprintf()</code> and terminate the program.</p>
  
  <p>What is the proper way to handle error termination? Should I allow the function to print to <code>stderr</code>, then return 1 back to <code>main()</code> then have <code>main()</code> actually terminate, or should the function itself handle error printing and program termination?</p>