title: How to check the input contain non digits characters?
body: <p>Hi everyone I'm new to C, I have a question about how to check the input whether contain non-digital characters.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;ctype.h&gt;
  #include &lt;stdlib.h&gt;
  
  int main(void){
   char arraySize;
   scanf("%c",&amp;arraySize);
   if(!isdigit(arraySize)){
    printf("BADINPUT\n");
   }else{
    return 0;
   }
  }
  </code></pre>
  
  <p>When I run my code, I Inputed <code>xy4</code> and It <code>printf</code> BADINPUT. However, when I Iputted <code>4xyz</code> It did not <code>printf</code> BADINPUT. It seems like only read first charcter and check whether <code>isdigit</code> or not.</p>
  
  <p>How can I change my code so that when I Inputted <code>4xyz</code> It will also be BADINPUT?</p>