名前空間
変種
操作

switch statement

提供: cppreference.com
< c‎ | language

 
 
C言語
一般的なトピック
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.
プリプロセッサ
コメント
キーワード
ASCIIチャート
エスケープシーケンスを
C
フロー制御
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.
条件付き実行文
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
繰り返し文
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.
文をジャンプします
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.
機能します
Original:
Functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
関数の宣言
の歴史。インライン指定
タイプ
Original:
Types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
指定子
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指定
記憶クラス指定子
alignas指定子 (C99)
リテラル
Original:
Literals
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Original:
Expressions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
評価の順序
代替演算子
演算子
演算子の優先順位
ユーティリティ
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
属性 (C99)
キャストします
その他
Original:
Miscellaneous
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
インラインアセンブリ
 
一体型の引数の値に応じてコードを実行します
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.
どこで使用されるコードの多くの枝の1つまたはいくつかのうち、積分値に応​​じて実行する必要が.
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.

目次

[編集] 構文

switch ( expression ) {
case constant_expression1 :
statement1 (オプション)
case constant_expression2 :
statement2 (オプション)
... ... ...
case constant_expressionn :
statementn (オプション)
default: default_statement (オプション)

}

[編集] 説明

expressionは、整数値に変換式でなければならない.
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.
すべてconstant_expressionsは、この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.
expressionが定義constant_expressioniのいずれかの値に等しい値に評価される場合は、statementi(存在する場合)およびそれ以降のすべてのステートメント(default_statement除いて、存在する場合)が実行されます。 expressionの値がconstant_expressionsのいずれとも一致しない場合は、存在する場合、default_statementが実行されます.
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.
が使用可能であることを、覚えておくと便利です。その場合switch文の実行は終了します.
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.

[編集] キーワード

switch, case, default

[編集]