title: Program only reading first row of Matrix in C
body: <p>I am trying to read in a 3x3 matrix from a file. The file contains data that looks like this.</p>
  
  <pre><code>5 65 3
  3 11 15
  22 8 3
  </code></pre>
  
  <p>So far I have the following code,</p>
  
  <pre><code>int data[3][3];
  int i = 0;
  int j = 0;
  FILE *fptr = fopen("data.txt", "r");
  
  for(; i &lt; 3; ++i){
      fscanf(fptr, "%d %d %d", &amp;(data[i][0]), &amp;(data[i][1]), &amp;(data[i][2]));
  }
  i = 0;
  
  for(; i &lt; 3; ++i){
      for(; j &lt; 3; ++j){
          printf("%d ", data[i][j]);
      }
      printf("\n");
  }
  
  fclose(fptr);
  </code></pre>
  
  <p>However, only the first line of the matrix is read from the file. When I try printing only the first line is shown followed by two empty lines.</p>