switch jumps to the matching case label. Always break so you do not fall through.
switch is a jump table. You hand it an integer (or a char), and it leaps to the matching case label. It is the right tool when you have exact values — Monday is 1, not “greater than 0.”
selector
skip
skip
Wed
Each step highlights the matching C line. Program output appears only when a line that prints actually runs.
Five questions. Pick one answer each, then Check answers. The correct choice turns green.
1. d = 3 prints:
case 3.
2. What does break do here?
Prevent fall-through.
3. default runs when:
Leftover.
4. Missing break after case 3 would:
Fall-through.
5. switch cannot directly test:
Need if for ranges.