For Loop Example
sum = 0;
for(i = 1; i <= 4; ++i)
sum += i;
printf("i=%d, sum=%d\n",
i, sum);
prints
i=5, sum=10
++ is called increment operator. ++i is the same as i = i + 1, or i += 1.
++ applies only to integral type variables.
Previous slide
Next slide
Back to first slide
View graphic version