title: Count how many integers are in the text file using fscanf
body: <p>For example, I have a txt file with all integers. I want to count how many <strong>integers</strong> there are in order to allocate an array.</p>
  
  <pre><code>int array[0];
  int count = 0;
  FILE *file = fopen("file1.txt","r");
  while(fscanf(file,"%d",&amp;array[count])==1){
    count++;
  }
  printf("%d",count);
  </code></pre>
  
  <p>Currently there are error messages and won't go through. Is this the way fscanf work? </p>