Exploring Loops and Iteration

Some operations need to be repeated one or more times before their result is completely evaluated. The code to be repeated could be copied the required number of times, but this would be cumbersome. Instead, for this, there are loops—for …, while …, and do … while loops. Loops are for statements that must be evaluated multiple times. We will explore C loops. After considering loops, the much-maligned goto statement will be considered.

The following topics will be covered in this chapter:

  • Understanding brute-force repetition and why it might be bad
  • Exploring looping with the while()… statement
  • Exploring looping with the for()… statement
  • Exploring looping with the do … while() statement
  • Understanding when you ...

Get Learn C Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.