title: Checking if input is an integer in C
body: <p>I'm trying to check if a number is an integer (num).</p>
  
  <p>In the main() - </p>
  
  <pre><code>int num, input;
      printf("Please enter an integer greater than 1:\n");
          input = scanf("%d",&amp;num);
          if ( input != 1 ){
              printf("Invalid input!\n");
              return 1;
          } 
  </code></pre>
  
  <p>but when the input is not an integer (33.3 for example), the value of "input" is still 1.</p>
  
  <pre><code>printf("%d ", input);
  </code></pre>
  
  <p>gives me back 1.</p>
  
  <p>The rest of the program works. Just got stuck on this minor thing.</p>