Types of Errors
Some common types of errors are given below:
• Syntax is a set of grammatical rules to construct a program. Every programming language has unique rules for constructing the sourcecode.
• Syntax errors occur when grammatical rules of C++ are violated.
• Example: if you type as follows, C++ will throw an error.
cout << “Welcome to Programming in C++”
• As per grammatical rules of C++, every executable statement should terminate with a semicolon. But, this statement does not end with a semicolon.
• A Program has not produced expected result even though the program is grammatically correct.It may be happened by wrong use of variable / operator / order of execution etc. This means, program is grammatically correct, but it contains some logical error. So, Semantic error is also called as “Logic Error”.
• A run time error occurs during the execution of a program. It is occurs because of some illegal operation that takes place.
• For example, if a program tries to open a file which does not exist, it results in a run-time error