Espacios de nombres
Variantes
Acciones

switch statement

De cppreference.com
< c‎ | language

 
 
Lenguaje C
Los temas generales
Original:
General topics
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Preprocessor
Comentarios
Palabras clave
Tabla ASCII
Las secuencias de escape
Historia de C
Control de flujo
Original:
Flow control
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Sentencias condicionales ejecución
Original:
Conditional execution statements
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
switch statement
Instrucciones de iteración
Original:
Iteration statements
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Ir declaraciones
Original:
Jump statements
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Funciones
Original:
Functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
declaración de la función
especificador inline
Tipos
Original:
Types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Los especificadores
Original:
Specifiers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
cv especificadores
especificadores de clase de almacenamiento
alignas especificador (C99)
Los literales
Original:
Literals
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Expresiones
Original:
Expressions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
orden de evaluación
los operadores alternativos
los operadores
prioridad de los operadores
Utilidades
Original:
Utilities
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
typedef declaration
atributos (C99)
proyecta
Varios
Original:
Miscellaneous
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Montaje en línea
 
Ejecuta el código en función del valor de una discusión integral
Original:
Executes code according to value of an integral argument
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Usado donde una o varias de muchas ramas de código necesita ser ejecutado de acuerdo a un valor integral .
Original:
Used where one or several out of many branches of code need to be executed according to an integral value.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Contenido

[editar] Sintaxis

switch ( expression ) {
case constant_expression1 :
statement1 (opcional)
case constant_expression2 :
statement2 (opcional)
... ... ...
case constant_expressionn :
statementn (opcional)
default: default_statement (opcional)

}

[editar] Explicación

expression deberá ser una expresión, convertible a un valor entero .
Original:
expression shall be an expression, convertible to an integer value.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Todos constant_expressions deberá ser expresiones constantes, convertibles a un valor entero, que es único dentro de esta declaración switch
Original:
All constant_expressions shall be constant expressions, convertible to an integer value, which is unique within this switch statement
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Si el expression evalúa como un valor, igual al valor de uno de los constant_expressioni definido, el statementi (si están presentes) y todas las declaraciones posteriores (excepto default_statement, si está presente) se ejecutan. Si el valor de la expression no está de acuerdo con cualquiera de las constant_expressions, la default_statement se ejecuta si está presente .
Original:
If the expression evaluates to a value, equal to the value of one of the defined constant_expressioni, the statementi (if present) and all subsequent statements (except default_statement, if present) are executed. If the value of the expression does not match any of the constant_expressions, the default_statement is executed if present.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
se puede utilizar. En ese caso, la ejecución de la instrucción switch termina .
Original:
It is useful to note, that if the execution of subsequent statements is undesirable, the
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar] Palabras clave

switch, case, default

[editar] Ejemplo