Mail Archives: djgpp/1998/01/27/13:50:23
Hans Winther" wrote:
>I have seen the use of case and switch
>commands in some demo programs,
>but i don't know what they mean.
>I know just about all other basic
>commands in C/C++.
Off topic, but ....
* The "switch" statement causes control to be transferred to one of
several statements depending on the value of a condition.
* Any statement within the switch statement can be labeled
with one or more "case" labels as follows:
"case constant-expression :"
* There shall be almost one label of the form
"default :"
* When the switch statement is executed, its condition is evaluated and
compared with each case constant. If one of the case constants is
equal to the value of the condition, control is passed to the
statement following the matched case label. If no case constant
matches the condition, and if there is a default label, control passes
to the statement labeled by the default label. If no case matches
and if there is no default then none of the statements in the switch is
executed.
* To exit from a switch - case statement use "break;"
=====================================================================
Alex Lozano - (Electronic Engineer) E-mail: alex AT inti DOT gov DOT ar
INTI - CITEI alexlozano AT geocities DOT com
CC 157 - (1650) - San Martín
Buenos Aires - ARGENTINA
Home Page: http://www.geocities.com/SiliconValley/Vista/6521
=====================================================================
- Raw text -