+ 1
What the difference between (else if )and (switch_case)!?
l think they do the same work!
2 Answers
+ 1
Frankly, you're quite right! The reason that there's an option for a switch statement is because it allows for an easier way to test the value of a certain variable, which can be a little more limiting compared to the else-if statements.
+ 1
similar but not same, see e.g. Duff's device.
And switch is not more limiting, you have normally more freedom with switch, because its more or less only a pack of goto's.