# int i = 0; i < n; i++ compared to n>0; n--

Every time a forever loop is made, the statement in the parentheses is

``````(i = 0; i < n(or some variable); i++)
``````

Why doesn't this work?

``````(n > 0; n--)
``````

What you have displayed are loops, but not forever loops. The first loop that you describe,

``````for(i = 0; i < n(or some variable); i++)
{
//do something
}
``````

is the standard construction of a loop that will start with i = 0 and increment on each pass until i is no longer less than n, at which time the loop ends and processing continues with the next line of code after the curly braces. You could do exactly the same thing with this:

``````for(i = n; i > 0; i--)
{
//do something
}
``````

The difference here is that i is decrementing from n to 1. At 0, the loop stops. There are many variations that you could use, some more suitable than others for a given use, but all just as valid. None of these are forever loops.

A forever loop would be such that the test condition is always true. It can also be accomplished by not having a test condition. Examples:

``````for(i=0;  ; i++) ...
for(   ; true; ) ...
for( ;  ; i++) ...
``````

and so on. A more common construction of a forever loop is this:

``````while (true)
{
// do something
}
``````

This will run forever, or until some code inside the loop causes it to stop, such as a break or return statement.