title: How to print lines from a file in reverse order
body: <p>I am trying to print a file in reverse order. I am using arrays to save each lines data. So far I was able to print every line in a normal order.</p>
  
  <p>index is the number of lines I am referring to and FuncIndex the same thing but has been declared again in the function.</p>
  
  <pre><code>file = fopen("../quotes.data","r");
  while (NumOfField == 8) {
      NumOfField = fscanf(file,"%d,%c,%d,%d,%c,%c,%lf,%lf", &amp;quote[index], &amp;roomletter[index], &amp;length[index], &amp;width[index], &amp;paint[index], &amp;ceiling[index], &amp;cost[index], &amp;setup_cost[index]);
      index++;
  }
  index--;
  fclose(file);
  </code></pre>
  
  <p><br>
  In Function: </p>
  
  <pre><code>int FuncIndex;
  for (FuncIndex = 0; FuncIndex &lt;= index; FuncIndex++) {
      printf("\n%5d   %1c   %3d    %3d    %1c      %1c    %8.2lf %6.2lf", quote[FuncIndex], roomletter[FuncIndex], length[FuncIndex], width[FuncIndex], paint[FuncIndex], ceiling[FuncIndex], cost[FuncIndex], setup_cost[FuncIndex]);
  }
  </code></pre>
  
  <p>Now I tried changing the for loop to:</p>
  
  <pre><code>for (FuncIndex = index; FuncIndex &gt;= 0; FuncIndex--) &gt;
  </code></pre>
  
  <p>But the output prints empty. Although when I change the 0 to any number, that corresponding line gets printed.</p>
  
  <p>The output That prints is:</p>
  
  <pre><code>Quote Room Length Width Paint Ceiling     Cost  Setup
  ===== ==== ====== ===== ===== =======  =======  =====
  531   A    10     10    b      n       96.00 100.00
  531   B    15     15    b      n      144.00   0.00
  531   C    20     20    b      n      192.00   0.00
  </code></pre>
  
  <p>I am looking to get this output reversed like:</p>
  
  <pre><code>Quote Room Length Width Paint Ceiling     Cost  Setup
  ===== ==== ====== ===== ===== =======  =======  =====
  531   C    20     20    b      n      192.00   0.00
  531   B    15     15    b      n      144.00   0.00
  531   A    10     10    b      n       96.00 100.00
  </code></pre>
  
  <p>Please excuse me if I putted the output in the code section because then the formatting would change</p>
  
  <p>Thank you.</p>