title: Validating the scanf entry
body: <p>I am looking at putting some validation into this loop to make sure then entry is greater or equal to and less than or equal to 1024.</p>
  
  <p>I have tried </p>
  
  <pre><code>if(scanf("%d", &amp;records[*rCount].source) == 1 &amp;&amp; &amp;records[*rCount].source &gt;= 1 &amp;&amp; &amp;records[r*Count].source &lt;= 1024)
  </code></pre>
  
  <p>but that stops all entries working.</p>
  
  <p>Below is the do while loop I am currently using thanks.</p>
  
  <pre><code>do{
          puts("What is the source of this packet?: ");
          if(scanf("%d", &amp;records[*rCount].source) == 1){  //if correct insert the record at the index
              valid=1;                                //determined by rCount(the current     record count passed to addRecord
          }
          else{
              valid = 0;
              getchar();
              puts("\nNot a valid input");
          }
  
      }while(valid!=1);
  </code></pre>