C ErrorsLesson 44Free preview
C Errors
This lesson is part of C · All levels
Summary
Errors in C are grouped into compilation errors that stop the build process, runtime errors that occur when a program is running, and logic errors that make the result erroneous without error messages. Compilers also give warnings that should be handled because they often mark actual bugs. Knowing the type of error helps to select the right correction steps and speeds up the debugging process.
Key points
- Compilation error: unknown type names, missing parentheses, or undeclared variables so that the program is not created.
- Runtime error: segmentation errors, zero partition, and off-limits array access occur while the program is running.
- Logic error: a program runs without an error message but the result is wrong, and the most difficult to find.
- The compiler's warnings should not be ignored; compile with -Wall -Wextra to capture more problems.
- Bugs can also be behaviour, such as overloading numbers or reading unfilled memory.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.