Errors:
No one is perfect; everyone commits some errors in one form or the other. Programming errors often remain undetected until an attempt for compiling or executing the program is made. Since error stop the program to be executed successfully.
An error is an illegal
operation performed by the user which results in abnormal working of the
program.
The
common types of errors that can occur are:
- Syntax Errors (Compile Time Errors): The syntax of a programming language specifies the rules for creating a proper program in that language. A syntax error occurs in C when the compiler encounters code that violates C’s language rules (i.e. its syntax). Syntax errors are also called compile time errors, because the compiler detects them during the compilation phase. An Example of syntax error is: int a,b In above statement syntax error is occur because semicolon is missing.
- Run Time Errors ( Execution Errors):
Run time errors occur during program execution after successful compilation. Some common run time errors are:
- Divide a number by 0.
- Null pointer assignment.
- Trying to find out square root of a negative number.
- Stack Overflow
- Logical Errors (Semantic Error ): Syntactic and execution errors are easier to find because they can just be located by generation of error messages on compilation or execution of a program. But some programs provide wrong output when certain input values are supplied to it. Such errors which provide incorrect output but make program to appear error free are called logical errors. They are hard to detect. The technique of finding and correcting these types of errors is called logical debugging. The hit and trial method is the one of the best method of finding logical errors.
Post a Comment