11 The for Loop

Chapter 12
Controlling Flow
Now that you have mastered the looping constructs, you should learn some loop-related statements. This chapter explains two additional looping commands, the break and continue statements, which control the way loops operate. These statements work with while loops and for loops. In addition to completing your study of C loops, you'll also learn two new control statements, the switch and the goto statements. They improve upon the if and else-if constructs by streamlining the multiple-choice decisions your programs make. switch does not replace the if statement, but you may prefer switch when your programs must perform one of many different actions. goto enables you to modify the order that your program's statements execute.
This chapter teaches you the following topics:
Using break with for loops
The continue statement
How to control conditional flow with switch
Working with goto

 



C by Example
C by Example
ISBN: 0789722399
EAN: 2147483647
Year: 1999
Pages: 43
Authors: Greg Perry

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net