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:


  1. 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.
  2. Run Time Errors ( Execution Errors): Run time errors occur during program execution after successful compilation. Some common run time errors are:
    1. Divide a number by 0.
    2. Null pointer assignment.
    3. Trying to find out square root of a negative number.
    4. Stack Overflow
    Run time errors difficult to find as the compiler does not point to the line at which this error occur. The compiler doesn’t do anything with these types of errors.

  3. 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.

Previous                                                                                   Next

Powered by Blogger.