title: prevent user to input incorrect data type
body: <p>I was trying to scan only allowed types in my c program.
  I have a variable which is integer.I want to scan again while user input is character.</p>
  
  <pre><code>   int usercount;
  
     do{
       printf("enter user count");
       scanf("%d",&amp;usercount);
     }
     while(!isdigit(usercount));
  </code></pre>
  
  <p>But when input is char it's in a infinite loop.Can anyone help?</p>