title: Error: 'for' loop initial declarations are only allowed in c99 mode
body: <p>I've got this problem where I can only compile using the gcc -std=c99 but however, i need it to compile using c89 aka gcc -Wall.  This is part of my code where i use the 'for' loop.  Please see if you can help me out thank you in advance.</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  int main()
  {
      int arr[100],i=0,ch;
      int n = 1, sum = 0;
      printf("Check out our selection! \n");
      printf("Airhead - 25 cents\n");
      printf("Fun Dip - 40 cents\n");
      printf("Gummi Bears - 20 cents\n");
      while (n != 0)
      {
          printf("Insert Coins: ");
          scanf("%d",&amp;n);
          arr[i++] = n;
      }
  
      for(int j=0;j&lt;i;j++)
      {   sum = sum + arr[j];
      }
  ......
  </code></pre>