(Because I felt like helping someone out, and avoiding doing
work) For loops are used when a particular action needs to be
carried out a set number of times - ie; printing an int to the
screen 10 times (a boring example, but a simple one). The basic
statement in C is as follows: for (initialization_expression;
loop_condition; increment_expression) // code goes here…
Basically, for EACH for loop, you need a counter value. For
nested loops, these counter values must be declared before any
loop begins, or the value will be initialised each loop, and you
may end up in an infinite loop. //An example of properly set out
nested for loops: for(i=0; i<=10; i++) //code can go here
for(j=0; j<=5; j++) //code goes here This code demonstrates the
first loop running 10 times, with the second loop running 5
times per each first loop. At the end of all execution, the
first for loop would have run 10 times, but the second would
have run 50 times all up. - “i++” is the same as “i = i + 1” -
The 10 in “i<=10” and the 5 in “j<=5