There are three types of errors syntax, logical, and run-time errors.
1. Syntax errors: These errors occur because of wrongly typed statements, which are not according to the syntax or grammatical rules of the language.
For example, in C, if you dont place a semi-colon after the statement . it results in a syntax error. printf(Hello,world) error in syntax (semicolon missing)
printf("Hello,world"); - This statement is syntactically correct.
2. Logical errors: These errors occur because of logically incorrect instructions in the program. Let us assume that in a 1000 line program, if there should be an instruction, which multiplies two numbers and is wrongly written to perform addition. This logically incorrect instruction may produce wrong results. Detecting such errors are difficult.
3. Run time errors: These errors occur during the execution of the programs though the program is free from syntax and logical errors. Some of the most common reasons for these errors are
when you instruct your computer to divide a number by zero.
when you instruct your computer to find logarithm of a negative number.
when you instruct your computer to find the square root of a negative integer. 4. Linking Error: These errors are occurs due to the linking of header files to the current program.
Unless you run the program, there is no chance of detecting such errors