Some aspects of C that often trip up programmers:
-
Complex operator precedence rules - use parentheses liberally
-
Type casting can lead to unexpected behavior
-
switch
Β statements βfall throughβ cases - addΒbreak
Β statements -
static
Β means different things in local vs global scope -
Common bugs:
- Forgetting break statements in switch blocks
- Mismatched pointer types in casts
- Misunderstanding order of increment/decrement operators
- Undefined behavior from numerical overflow or invalid memory access