title: Checking that the input is int while also exiting with 0 status in c
body: <p>I am trying to get input from the user/ file redirection and need to return an error when the input is not an integer. For this, I am using</p>
  <pre><code>int s= scanf(&quot;%d&quot;, x);
  if (s==0){
      fprintf(stderr, &quot;Non integer value input.&quot;);
  }
  </code></pre>
  <p>but this means that I can not use it to terminate the program when I run out of inputs. How can I accomplish both since getting the number of successful scans is the only way I know to figure out if the input has ended.</p>