Programming Errors

Programming Errors

Error
Errors are the problems or faults that occur in the program, making the program’s behavior abnormal. The error can be syntax or logic of the program. If a program contains an error, it will either not producce output or may produce inaccurate output. The process of detecting and correcting the error is known as debugging.
Different types of error are:

Syntax error:
Syntax error occurred at the compilation time. It occurs due to syntax errors in code. These errors are mainly occurred due to the mistakes while typing or mot following the syntax of the specified programming language.

Run time error:
Run time error occurred during the execution time. It happens when the code initializes large unnecessary memory.

Logical error(Semantic error):
Logical error leads to an undesired output. Semantic errors occured when the statements are not understandable by the compiler. If there is logical error we will have a output but that output is not our desired output. Though programs maybe syntactically correct, the validity or the logic might be wrong. The meaning of the instruction maybe invalid in such a way that computer cannot perform the task.

Difference between Semantic error and Syntax error.

Logical Error ( Semantic Error ) Syntax Error
1. It is an error in the program’s logic. 1. It is the grammatical rules that govern the way in which words, symbols, expressions are formed.
2. It is not identified by the compilers and interpreters during translation. 2. It is located by the translator during translation.
3. If a program contains a logical error, it produces output but it will not be accurate. 3. If a program contains a syntax error, it will not produce output.
4. Documentation or reference or guideline of logic is not available to the users. 4. Documentation or reference of the set of rules syntaxes are made available to the users.
5. Any error has to be detected by comparing the output of the program with the desired output. 5. Error is detected by the language translator.
6. It can be solved only by experienced programmers. 6. Normal graduates can debug syntax errors.
7. Cost is high in correcting the semantic error since the program development team are needed to be involved to solve. 7. Cost is low since normal users can solve this problem.
8. It is complex and time consuming to debug. 8. It is easier and not consuming to debug as a logical error.