title: How do you deal with false input?
body: <p>I want to create a program that takes an integer as a variable. I want a way to deal with the error caused when a string or character is scanned on the buffer instead. My code would look something like this:</p>
  <pre class="lang-c prettyprint-override"><code>int input;
  
  printf(&quot;Enter an integer: &quot;);
  scanf(&quot;%d&quot;, &amp;input);
  </code></pre>
  <p>Just something simple like that, but I would like for the program to print out something like &quot;Please enter a number&quot; when someone enters &quot;test&quot; into the buffer, <strong>while still using scanf</strong>.</p>