Infolinks In Text Ads

Monday, 1 August 2011

14.3 Statements


Statements

The switch statement allows you to jump to one of a number of numeric case labels depending on the value of an expression; it's more convenient than a longif/else chain. (However, you can use switch only when the expression is integral and all of the case labels are compile-time constants.)
The do/while loop is a loop that tests its controlling expression at the bottom of the loop, so that the body of the loop always executes once even if the condition is initially false. (C's do/while loop is therefore like Pascal's repeat/until loop, while C's while loop is like Pascal's while/do loop.)
Finally, when you really need to write ``spaghetti code,'' C does have the all-purpose goto statement, and labels to go to.

Twitter Delicious Facebook Digg Stumbleupon Favorites More