case keyword

   
case keyword Case label for switch statement

  statement  := case  constant-expression  :  statement  

The case keyword labels a statement in a switch statement. A single statement can have multiple labels. You cannot use case outside of a switch statement.

Note that case labels have no effect on the order in which substatements are executed within a switch statement. Use the break statement to exit from a switch statement.

Example

 switch(c) {  case  '+':   z = add(x, y);   break;  case  '-':   z = subtract(x, y);   break; } 

See Also

break , default , statement , switch , Chapter 4

   


C++ in a Nutshell
C++ in a Nutshell
ISBN: 059600298X
EAN: 2147483647
Year: 2005
Pages: 270
Authors: Ray Lischner

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