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;
}
forloop—the incrementer—only executes after the logic within the loop has been executed, whereas you're assuming it will happen before.for (a = 0; a < 10; execute logic; a++).