title: Using fscanf() using feof()
body: <p>Here's my code.</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  void main(){
      FILE *fp;
      int a,b;
      fp=fopen("hello.txt","r");
      while(!feof(fp)){
        fscanf(fp,"%d %d",&amp;a,&amp;b);
        printf("%d %d\n",a,b);
      }
  }
  </code></pre>
  
  <p>My hello.txt is</p>
  
  <pre><code>1   2
  3   4
  </code></pre>
  
  <p>My Output is</p>
  
  <pre><code>1   2
  3   4
  4   4
  </code></pre>
  
  <p>Why is my last line being printed twice. Has not fp reached EOF?</p>
  
  <p>Also,the tag in stackoverflow says <code>Usually, when it is used, the code using it is wrong.</code>
  What does it mean? </p>
  
  <p>Thanks.</p>