Namespace
Varianti

switch statement

Da cppreference.com.
< c‎ | language

 
 
Linguaggio C
Temi generali
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.
Preprocessore
Commenti
Parole chiave
Tabella ASCII
Sequenze di escape
Storia di C
Controllo del flusso
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.
Dichiarazioni esecuzione condizionale
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
Iterazione dichiarazioni
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.
Vai dichiarazioni
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.
Funzioni
Original:
Functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
dichiarazione di funzione
specificatore inline
Tipi
Original:
Types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Specifiers
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 specificatori
della classe di archiviazione specificatori
alignas specificatore (C99)
Letterali
Original:
Literals
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Espressioni
Original:
Expressions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
ordine di valutazione
operatori alternativi
operatori
precedenza degli operatori
Utilities
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
attributi (C99)
getta
Varie
Original:
Miscellaneous
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Montaggio in linea
 
Esegue il codice in base al valore di un argomento integrale
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.
Usato in cui uno o più di molti rami di codice devono essere effettuate secondo un valore integrale.
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.

Indice

[modifica] Sintassi

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

}

[modifica] Spiegazione

expression deve essere un'espressione, convertibile in un valore intero.
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.
Tutti constant_expressions devono essere espressioni costanti, convertibili in un valore intero, che è unica in questo prospetto 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.
Se il expression restituisce un valore, pari al valore di uno dei constant_expressioni definito, il statementi (se presente) e tutte le istruzioni successive (eccetto default_statement, se presenti) vengono eseguiti. Se il valore della expression non corrisponde a nessuno dei constant_expressions, il default_statement viene eseguito se 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.
può essere utilizzato. In tal caso l'esecuzione dell'istruzione 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.

[modifica] Parole chiave

switch, case, default

[modifica] Esempio