There are three types of errors in C programming
(1)Syntax errors
(2)Logical errors
(3)Run-time errors
(1) Syntax errors- These errors occur because of wrongly typed statement, which are not according to the syntax or grammatrical rules of the language.
For example- In C, if you don't place a semi-colon after the statement (as show below), it results in a syntax error.
printf("Hello word")
Error in syntax (semicolon missing)
printf("Hello word");
This statement is syntactically correct.
(2) Logical errors- These errors occur because of logical incorrect instruction in the program.
For example - Let us assume that in a 1000 line program, if there should an instruction, which multiplies two numbers and is wrongly Written to perform addition. This logically incorrect instruction may produce wrong result. Detecting such errors are difficult.
(3) Run-time errors- These errors occur during the execution of the program though the program is free from syntax and logical errors. Some of the most common reasons for these errors are-
A. When you instruct your computer to divide a number by zero.
B. When you instruct your computer to find logarithm of a negative number.
C. When you instruct your computer to find the square root of a negative integer.