Error Handling in C
C has no exceptions: functions return error codes, NULL or set `errno`.
Easy
Check every return value that can fail; propagate errors upwards; clean up resources on every path.
Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.
Discussion (0)
Sign in or join free to ask questions and discuss this topic.