Errors (also known as bugs) are common while writing a program. The errors should be detected and removed, or else, the whole set of statements of a program will simply produce wrong result. Errors can be detected only while running the program.
In C errors are of 3 types - Syntax Error , Logical Error and Run-time Error .
In C errors are of 3 types - Syntax Error , Logical Error and Run-time Error .
- Syntax Error : These are generally typing error of the statements that are not according to the grammatical rules or syntax of the language.
- Syntax error will definitely occur and the program will not compile if semicolon (separator) is not placed at the end of the statement.
- Logical Error : It occurs due to entering logically incorrect statement in the program.
- If an addition program is instructed to do subtraction, it will compile, but produce a wrong output. This is logical Error.
- Run - time Error : A program free of syntax and logical errors, may not produce result due to run - time errors, which usually occur due to the following reasons :
- Statements instructing to divide a number by zero.
- Statements instructing to find logarithm of a negative number.
- Statements instructing to find the square root of a negative number.