Q:

C program incrementing variable with for loop

I am trying to learn the C programming language on my own and have to depend on the internet for some help.  I am playing around with one variable and a for loop; incrementing the variable by 1, each iteration of the loop.  In this example, I am confused by the fact that the variable is not 1 in the first iteration of the loop.  It's like the arguement was skipped on the first pass.  I don't understand.
// This is a test of for loops

#include <stdio.h>

main () {

    int a;

    for (a = 0; a < 10; a++) {

        printf("%d\n", a);

    }

    return 0;
}

A:

Maybe it's easiest to understand as follows.  In C, a loop written like this:
for (a = 0; a < 10; a++) {
   printf("%d\n", a);
}

is equivalent to this:
a=0;
while (a<10) {
   printf("%d\n", a);
   a++;
}

The for-loop notation is meant to collect up all of the loop control information at the top of the loop as written, but the parenthesized part after the keyword "for" is not executed as a group of statements before the body, it's treated as if it were written as shown in the while loop.
You can also write an infinite loop like this in C:
for (;;) {
   printf("Hello forever\n");
}

which is equivalent to:
while (1) {
   printf("Hello forever\n");
}

