Hi !
can someone please explain to me exactly how the for loop work?! I mean when exactly the "i++" modified? when entering the loop or once returning from the loop it gets modified? also is it first gets modified and then check the condition of for loop or first checking the condition and then adding the "i"?
if after loop itself I added the operand "i" will be it added again once returning to the loop itself? I mean like this:
, then will the pc modify the "i" by 5 and then after returning to for itself will start from the value that I added (by 5 ) + 1? for example here first i=0, so it will add it by 5 after entering the for loop, so i=5, then it will return to the for loop, my question will he returns by value i=5 or i=6? because he already does i++ in iteration i=0 so..?! thanks in advance!.
what's the difference between: "++i", "i++";
thanks in advance !!
can someone please explain to me exactly how the for loop work?! I mean when exactly the "i++" modified? when entering the loop or once returning from the loop it gets modified? also is it first gets modified and then check the condition of for loop or first checking the condition and then adding the "i"?
if after loop itself I added the operand "i" will be it added again once returning to the loop itself? I mean like this:
Code:
for (int i=0;i<10;i++)
{
i+=5;
}
what's the difference between: "++i", "i++";
Code:
for(int i=0;i<10;++i)
Code:
for (int i=0;i<10;i++)
Last edited: