Errors and its types
While constructing a program it is very much possible that one made a typing error due to some unclear syntax of a particular statement. Such errors can be discovered by the compiler or by the linker or they can appear at run time. In general, there are four types of errors that occur in a computer program. These errors are:
- Compiler Errors
- Linker Errors
- Logical Errors
- Run time Errors
COMPILER ERRORS
Suppose we have forgotten to type the semicolon (;) at the end of the statement somewhere required position in the program, or mis-spelt any keywords or not match the braces, or made such kind of errors. If so, during the compiling process the compiling window, instead of displaying the success message will show errors. A message window will appear at the bottom of the screen. It will contain appropriate message for indication and locating the error(s). Press F6 to move from the message window to the edit window, correct the located error(s) and compile again the program.
LINKER ERRORS
Errors can also appear during the linking process. For instance, suppose we spell the word main () as maim( ). The program will compile correctly, but when we link it, the linking window will appear displaying errors instead of success. The linker must find a function called main (), without this it can't create an executable (.exe) file.
RUNTIME ERRORS
A comparatively small number of errors does not reveal (to display) themselves until the program executes. These errors include division by zero, stack overflow and the dreaded (unpleasant, wrong) null pointer assignment.
LOGICAL ERRORS
While constructing a program, we found that there is no compiling error, no linker error and no run-time error. The program has compiled and linked successfully and even running correctly, but the result obtain is not correct or undesirable. This means our program is completely syntactically correct but the logic of solving the program is wrong. Compiler or linker does not locate such kinds of errors. These are logical errors and to remove them we have to chase the strategy of solving that problem.