Iteration

Iteration is the process of doing something over and over. Along with selection, you will use iteration to control the flow of programs to achieve a solution to your problem.

You will know when you need to use an iteration construct by looking at your flow chart for a problem. If you have to make the same decision over and over, you need an iteration control structure. If you only need to make that decision once, you need a selection control structure.

There are 3 main ways to control iteration in C.

  • while
  • for
  • do-while

We will look at problems for each of these in the sections that follow.

results matching ""

    No results matching ""