Four Kinds of Errors
1. Syntax Errors
Detected by Compiler. A message is displayed for programmer.
(Note: "Warnings" should be treated as errors.)
Cause: Incorrect statement format. Statement
doesn't follow the rules of the language.
Example: printf("Hello World";
Notes: The compiler message may be misleading. The compiler
can only indicate where it got confused, not necessarily where you made
the mistake.
Example:
Pasta = 17;
Meal = pasta + sauce;
2. Runtime Errors (technically, "exception")
Program compiles successfully, but during execution attempts an illegal
operation, such as dividing by zero.
Detected by Operating System.
Symptom: "This program has attempted an illegal operation and
will be terminated." dialog box in Windows.
"Segmentation Fault" message in Unix.
3. Undetected Errors
Program executes and terminates normally, but produces the wrong
results.
Symptom: Output doesn't match expected results.
Example: Failure to initialize a total to zero.
4. "Logic Error"
A special kind of undetected error that results from a faulty algorithm.
Example: "Infinite Loop" causes the program to never
terminate.