Saved Bookmarks
| 1. |
Explain run time error with example. |
|
Answer» Run-Time Errors: A program’s syntax may be correct- H may be compiled and linked successfully. But it may not be executed successfully because of run-time errors. Such errors are found at the time of executing the program. Let us consider the following program segment n = 9; while (n > 1) { n-1 m = m / (n -1); } When the value of n becomes 2, the expression a > 1 is true. Hence, the statement n – decreases the value of n by 1. When the value of n is 1, The divisor is O’ which generates a run-time error. Run-time errors include finding the square root of a negative number, stack overflow, and null pointer assignment. |
|