#include <stdio.h>
int main(){
       int i;
       for(i = 4; i; i--){
               printf("%d\n", i);
       }
}

output is:
4
3
2
1

So thats four loops the statement is false when i is 0.

~ Dale



Paul Parkyn wrote:
Hello all,
I am trying to port a C program to Pascal but am not sure of the outcome of a For Loop e.g.
         for( i = 4; i ; i--)  { do something}

        Could someone explain the effect of the middle i. I understand the middle 
i is used for a test e.g. i > 2
Just how many iterations of the loop will take place before the test of i will terminate the loop.

Best regards, Paul Parkyn
[EMAIL PROTECTED]
2006-05-16



Reply via email to