title: Validation error always on first try
body: <p>So I run my programme and when entering data for a structure on this set of code, I always get an error when I enter 1 as the data I wish to be entered. Although if i enter the same digit again, it seems to work. I have isolated it to be this part of the code as when I comment this out it all works fine!</p>
  
  <p>Anybody able to help?</p>
  
  <pre><code>do{
      puts("What is the packet type?");
      if(scanf(" %d", &amp;records[*rCount].type) == 1
          &amp;&amp; records[*rCount].type &gt;= 0
          &amp;&amp; records[*rCount].type &lt;= 10)
      {
          valid = 1;
      }
      else
      {
          valid = 0;
          getchar();
          puts("\nNot a valid input");
      }
  }while(valid!=1);
  </code></pre>
  
  <p>Structure definition:</p>
  
  <pre><code>struct packet{ // declare structure for packet creation
      int source;
      int destination;
      int type;
      int port;
      char data[51];
  };
  </code></pre>