switch Statement
Selects a case by an integer value.
Beginner
switch (cmd) {
case 'R': reset(); break;
case 'S': start(); break;
default: error();
}
Missing break falls through to the next case — comment intentional fall-through ([[fallthrough]]; in C23).
Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.
Discussion (0)
Sign in or join free to ask questions and discuss this topic.