Horizontal Nav

Monday, 13 July 2015

Errors in C++

Debugging

An error in a computer program is known as bug. The programmer can make different errors while writing programs.
The process of finding and removing bugs is known as debugging.

Run Time Error

A type of error that occurs during the execution of program is known as run-time error. It is caused when a statement directs the computer to execute an illegal operation such as dividing a number by zero.
The run-time errors are detected and displayed by the computer during execution. Run-time errors are normally caused due to wrong input from the user. The computer stops executing the program and displays error message if a run-time error occurs.

Example: 
The user may ask the program to open a file that does not exist. Similarly, the user may enter wrong type of data etc.

Logical Errors

A type of error that occurs due to poor logic of programmer is known as logical error. A logical error occurs when the program follows a faulty algorithm. A statement with logical error may produce unexpected and wrong results. For example, the programmer may have written a wrong formula to computer an answer. The formula will be executed without any error but will produce wrong results.

No comments:

Post a Comment