title: C Programming - Allow / determine / check "space (&#32)" input in integer
body: <p>First, sorry for my bad english, okay go to this question above. I was surfing a lot for reference about this question on many websites, but i didn't find the right answer yet.</p>
  
  <p>I'm trying to make a C program which this program can determine if the user input an integer or not, if user didn't input an integer then the program retry prompt to user for input an integer and so on. Everything is ok when i use scanf() return value on conditional statement, but the problem is, when user input 'whitespace/blankspace/space' (on ascii code as &amp;#32) and press 'enter', my program just stay running to wait for user input some characters or integer. </p>
  
  <p>I just wish that if the input is 'whitespace/blackspace/space', the program will repeat prompt to user to input an integer or the program just stop.</p>
  
  <p>Here is the case code :</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int main() {
  
      int number, isInt;
  
      printf("Input a number : ");
  
      do {
          if ((isInt = scanf("%d", &amp;number)) == 0) {
              printf("retry : ");
              scanf("%*s");
          } else if (number &lt; 0) {
              printf("retry : ");
          }
      } while (isInt == 0 || number &lt; 0); 
  
      printf("%d\n", number);
  
      return 0;
  }
  </code></pre>
  
  <p>I am a newbie in C, and curious about this. I know if i use %[^\n] &lt;-- code format for scanf() string and convert it to integer, the program that i mean will run correctly. Is there another way to solve this using %d code format? or using scanf() ?</p>
  
  <p>Please help me to break my curiosity, Regards :D</p>