<p>I'm trying to solve <a href="http://uva.onlinejudge.org/external/1/100.pdf" rel="noreferrer">the 3n+1 problem</a> and I have a <code>for</code> loop that looks like this: </p>

<pre><code>for(int i = low; i &lt;= high; ++i)
        {
                res = runalg(i);
                if (res &gt; highestres)
                {
                        highestres = res;
                }

        }
</code></pre>

<p>Unfortunately I'm getting this error when I try to compile with GCC:</p>

<blockquote>
  <p>3np1.c:15: error: 'for' loop initial
  declaration used outside C99 mode</p>
</blockquote>

<p>I don't know what C99 mode is. Any ideas?</p>

I'd try to declare
```
i
```
outside of the loop!
Good luck on solving 3n+1 :-)
Here's an example:
```
```
#include <stdio.h>

int main() {

   int i;

   /* for loop execution */
   for (i = 10; i < 20; i++) {
       printf("i: %d\n", i);
   }   

   return 0;
}
```
```
Read more on for loops in C
here
.