delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/27/13:50:23

Message-Id: <m0xxAS0-000S2dC@inti.gov.ar>
Comments: Authenticated sender is <alex AT natacha DOT inti DOT gov DOT ar>
From: "Alex Lozano" <alex AT inti DOT gov DOT ar>
Organization: INTI - CITEI
To: djgpp AT delorie DOT com
Date: Tue, 27 Jan 1998 15:55:13 +3
MIME-Version: 1.0
Subject: Re: Please help (switch statement)

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019