title: why scanf is safer than getchar?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/2507082/getc-vs-getchar-vs-scanf-for-reading-a-character-from-stdin">getc Vs getchar Vs Scanf for reading a character from stdin</a>  </p>
  </blockquote>
  
  
  
  <p>I know that <strong>getchar</strong> is a <strong>macro</strong> that <strong>takes character as an input</strong> from stdin .<br> where as <strong>scanf</strong> is <strong>a function</strong> that <strong>takes any data type as an input</strong> from stdin.<br>
  <br>As <strong>getchar</strong> is a macro thats why it helps to make <strong>program run faster</strong> ,but inspite of this it is  <strong>recommended to use scanf in place of getchar</strong>. <strong>WHY?</strong></p>
  
  <p>i learned on net that scanf is safe as compared to getchar,so ,<strong>what makes scanf safe</strong>?</p>