Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
More Pattern Work, More Loops 41 More Loop Examples Let's see some more examples of the use of the for loop and the increment/decrement operators. First, a count from zero to four: for ( i=0; i<5; i++) { // insert your code here ... // it will be executed for i= 0, 1, 2, 3, 4 } Then, a count down from four to zero: for ( i=4; i>=0; i22) { // insert your code here ... // it will be executed for i= 4, 3, 2, 1, 0 } Can we use the for loop to code an (infinite) main program loop? Sure we can, here is an example: main() { // 0. initialization code ...