Some aspects of C that often trip up programmers:
-
Complex operator precedence rules - use parentheses liberally
-
Type casting can lead to unexpected behavior
-
switchstatements “fall through” cases - addbreakstatements -
staticmeans 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