- 1

Amazing fact of Switch statement in C

https://pin.it/6HME563 Fact 1- C Switch Statement: The statements/code written above cases are never executed. Fact 2 - C Switch Statement: The default block can be put anywhere you want. Fact 3 - C Switch Statement: switch statement accepts only integral type expression. (int, char). Fact 4 - C Switch Statement: Two case labels cannot have the same value. Fact 5 - C Switch Statement: All the statements following a matching case execute until a break statement is reached. Fact 6 - C Switch Statement: The integral expressions used in Case labels must be constant expressions. Fact 7 - C Switch Statement: There can be only one default label. Is any other things left in switch statements in c?

9th Jan 2022, 4:15 PM
Willy Greham
3 Réponses
9th Jan 2022, 4:31 PM
Simba
Simba - avatar
+ 1
When you think you know all about the switch/case construct, then go look up "Duff's Device". It will blow your mind.
9th Jan 2022, 9:54 PM
Brian
Brian - avatar
0
Is any other things left in switch statements in c?
9th Jan 2022, 10:26 PM
Willy Greham