The For loop in C

for-loop-steps
for-loop-steps

For loop is probably the most popular looping instruction.

The for allows us to specify three things about a loop in a single line:

  • Setting a loop counter to an initial value.
  • Testing the loop counter to determine whether its value has reached the number of repetitions desired.
  • Increasing the value of loop counter each time the program segment within the loop has been executed.

In General the for loop syntax is :

for (initialize counter; test counter ; increment counter )

{

perform the task;

}

Leave a Reply