Operator Priority in the C Programming Language and other stuff
Priority | Symbol |
---|---|
1 | ++ |
1 | — |
1 | () |
2 | ! |
2 | (typecast) |
3 | * |
3 | / |
3 | % |
4 | + |
4 | – |
5 | <, <= |
5 | >, >= |
6 | ==, != |
7 | && |
8 | || |
9 | all assignment operators |
One restriction on the switch expression is that it must evaluate to an integral type (int
, char
, short
, long
, long long
, or enum
).
Ternary operators instead of if / then / else: condition ? do something : do something else;