機能 |
switch文で用いるデフォルトラベルを表す。 デフォルトラベルとは、switch文の分岐に対して該当する事例(case)が無い場合を表す。 |
---|---|
定義 | default : 文 |
実装例 |
#include <stdio.h> int main(void) { int a = 3; switch (a) { case 0: printf("Case 0\n"); break; case 1: printf("Case 1\n"); break; case 2: printf("Case 2\n"); break; default : printf("Default\n"); break; } return 0; } |
実行結果 |
Default |
default