February 2012
Intermediate to advanced
800 pages
23h 55m
English
Loops and repetitive tasks are very common in all software, and it is important that you are able to recognize them.
The for loop is a basic looping mechanism used in C
programming. for loops always have four components:
initialization, comparison, execution instructions, and the increment or decrement.
Example 6-12 shows an example of a for loop.
Example 6-12. C code for a for loop
int i;
for(i=0; i<100; i++)
{
printf("i equals %d\n", i);
}In this example, the initialization sets i to 0 (zero), and
the comparison checks to see if i is less than 100. If i is less than 100, the printf
instruction will execute, the increment will add 1 to i, and the
process will check to see if i is less than 100. These steps will ...