Is the following basically another way to write an infinite loop?
and
It looks like it to me, because the body decrements the 0 to -1, then the third expression increments -1 back to 0, and this keeps going on and on.
The second example will also continue to print also, because i=0, and 0*anything is always 0. Both infinite loops?
Code:
for ( i=0; i<20; i++)
i--;
and
Code:
for (i=0; i<20; i*20)
printf("modicication...");
It looks like it to me, because the body decrements the 0 to -1, then the third expression increments -1 back to 0, and this keeps going on and on.
The second example will also continue to print also, because i=0, and 0*anything is always 0. Both infinite loops?
Last edited: