title: Reading a file and finding the largest integer in C
body: <pre><code>int main()
  {
      int* ptr;
      int numofstu;
  
  printf(&quot;Please enter the number of students: \n&quot;);
  scanf(&quot;%d&quot;, &amp;numofstu);
  ptr = (int*) malloc(numofstu * sizeof(int));
  
  FILE* fptr;
  if ((fptr = fopen(&quot;C:\\Users\\umut\\Desktop\\students.txt&quot;, &quot;r&quot;)) == NULL)
  {
      printf(&quot;Error! opening file&quot;);
  }
  else
  {
      int highest=0;
      for (int i = 0; i &lt; numofstu; i++)
      {
          fscanf(fptr, &quot;%d\n&quot;, &amp;ptr[i]);
          if (ptr[i] &gt;highest )
              ptr[i] = highest;
          
  
      }
      printf(&quot;%d&quot;, highest);
  }
  }
  </code></pre>
  <p>Hello Guys!
  This is my second semester in C language but i'm still a amateur.</p>
  <p>What is the problem of this code chunk. I am posting a new question because i coulnt found any similar resource to solve it?</p>
  <p>Thanks in advance :)</p>
  <p>Edit: There are 9 integers in students.txt and their order is like int newline int</p>
  <p>Edit2: Result is 0 all the time.</p>