Infinite for loop in C with break statement:
What will be the output of this below program?
int i = 1;
for ( ; ; )
if ( i > 5 )
i += 2;
It prints 1,3,5,7. This is a for loop with out any condition (infinite loop). but we are having condition to break out of loop if i is > than 5. This will print 7 also, because breaking is happening after printing.
Back To Top