O'Reilly logo

Just Enough C/C++ Programming by Guy W. Lecky-Thompson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 7. Loops

I have mentioned the idea of repetition a few times now, the principle that you can ask the machine to perform the same task over and over for either a set number of times or until a condition is satisfied. Recall the analogy of beating eggs until they are fluffy; it is a loop in a cooking instruction.

In C programming, you have code blocks that can be executed a set number of times or until a given condition evaluates to true. This last mechanism uses the same kind of condition testing as the if statement that you saw in the previous chapter, so that should be familiar territory.

So the aim of this chapter is to discuss the various looping statements that C provides.

This chapter represents the built-in keywords and statements ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required