In the second argument it is actually ++i!=0
, The loop is interpreted as
for(++i;++i!=0;++i)
If you start with a positive i
or 0
, it will be an infinite loop and will invoke undefined behavior when i
reaches INT_MAX
.
If i
was -Ve
initially the loop may stop at a defined run.
EDIT: As you changed your question, Your code will not crash, but you can clearly understand the dry-run by replacing the second ++i
with ++i!=0
.
So the 1st iteration becomes:
(i=1;2!=0;++i/*this will execute later*/)
2nd iteration becomes:
i=3 //this is from the 1st iteration last part.
(/*initialization is done 1st time only*/;4!=0;++i/*again, this will execute after this iteration*/)
0
solved for(++i;++i;++i) the second argument is < or <=?