title: What makes a C standard library function dangerous, and what is the alternative?
body: <p>While learning C I regularly come across resources which recommend that some functions (e.g. <code>gets()</code>) are never to be used, because they are either difficult or impossible to use safely.</p>
  
  <p>If the C standard library contains a number of these "never-use" functions, it would seem necessary to learn a list of them, what makes them unsafe, and what to do instead.</p>
  
  <p>So far, I've learned that functions which:</p>
  
  <ul>
  <li>Cannot be prevented from overwriting memory</li>
  <li>Are not guaranteed to null-terminate a string</li>
  <li>Maintain internal state between calls</li>
  </ul>
  
  <p>are commonly regarded as being unsafe to use. Is there a list of functions which exhibit these behaviours? Are there other types of functions which are impossible to use safely?</p>