Chapter 7: Exploring Loops and Iterations

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. In this chapter, we will explore C loops. After considering loops, we'll move on to the much-maligned goto statement.

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 ...

Get Learn C Programming - Second Edition 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.