filmov
tv
Types of Error in C , C++ ,Syntax Error Logical Error ,Run Time Error

Показать описание
for any queries contact 0331-7472357
--------------------------
Types of errors /Bugs
Errors in the program are called bugs. The process of finding and removing bugs (or errors) in a program is known as debugging.
Types of Errors
Syntax Errors
Logical Errors
Runtime Errors
Types of Errors
1. Syntax Error
The set of rules of a programming language for writing statements of the computer program is known as syntax of the language. The program statements are written strictly according to these rules.
Syntax errors occur when syntax of a programming language are not followed in writing the source code. The compiler detects these errors at compiling time of source code. The compiler reports a proper error message about the error.
The compiler does not compile a program that contains syntax errors. The syntax errors are easy to detect and remove.
Causes of Syntax Error
Missing semicolon (;) at the end of statement.
Missing any of the delimiters i.e. { or }
Incorrect spelling of any keyword.
Using variables without declaration etc.
2. Logical Error
The errors in the logic of the program are called logical errors. The compiler cannot detect logical errors. A program with logical errors is compiled (translated) and run successfully but it does not give correct result.
Reasons of logical errors
The sequence of instructions used in a program may be incorrect.
The mathematical formulae used in program instructions may be incorrect etc.
The logical errors are difficult to detect. Logical errors can only be detected by examining all the units of the program one by one. It is a very time consuming and lengthy process.
Runtime Error
The errors that occur during the execution of program are called runtime errors or execution errors.
Reasons to occur runtime error
When the program attempts to perform an illegal operation such as dividing a number by zero.
If input data given to the program is not in a correct format or input data file is not found in the specified path.
If hardware problem occurs such as hard disk error, or disk full or printer error etc.
When a runtime error occurs, the computer stops the execution of program and displays an error message.
--------------------------
Types of errors /Bugs
Errors in the program are called bugs. The process of finding and removing bugs (or errors) in a program is known as debugging.
Types of Errors
Syntax Errors
Logical Errors
Runtime Errors
Types of Errors
1. Syntax Error
The set of rules of a programming language for writing statements of the computer program is known as syntax of the language. The program statements are written strictly according to these rules.
Syntax errors occur when syntax of a programming language are not followed in writing the source code. The compiler detects these errors at compiling time of source code. The compiler reports a proper error message about the error.
The compiler does not compile a program that contains syntax errors. The syntax errors are easy to detect and remove.
Causes of Syntax Error
Missing semicolon (;) at the end of statement.
Missing any of the delimiters i.e. { or }
Incorrect spelling of any keyword.
Using variables without declaration etc.
2. Logical Error
The errors in the logic of the program are called logical errors. The compiler cannot detect logical errors. A program with logical errors is compiled (translated) and run successfully but it does not give correct result.
Reasons of logical errors
The sequence of instructions used in a program may be incorrect.
The mathematical formulae used in program instructions may be incorrect etc.
The logical errors are difficult to detect. Logical errors can only be detected by examining all the units of the program one by one. It is a very time consuming and lengthy process.
Runtime Error
The errors that occur during the execution of program are called runtime errors or execution errors.
Reasons to occur runtime error
When the program attempts to perform an illegal operation such as dividing a number by zero.
If input data given to the program is not in a correct format or input data file is not found in the specified path.
If hardware problem occurs such as hard disk error, or disk full or printer error etc.
When a runtime error occurs, the computer stops the execution of program and displays an error message.