Is it possible to use logical operators in the switch structure in C?
Something like this:
switch (num) {
case (20 | 30):
printf("Funciona");
...
}
Is it possible to use logical operators in the switch structure in C?
Something like this:
switch (num) {
case (20 | 30):
printf("Funciona");
...
}
You can't use logical operators, but it is possible to use a single block in response to multiple value matches , which isn't exactly the same as a logical operator, but would be equivalent to your example. For this, the statement to build would be: