+ 1
What is run time error?
2 Antworten
+ 2
It is an error which occurs while the prgramm is running (e.g. dividing by 0, trying to acces memory which isnt allowed)
In comparison compile time errors are errors which are found while the prigramm is converted to machine language (the 0 and 1 stuff)
+ 2
As Alex wrote.
For example, if you forget to put a semicolon at the end, compiler can’t even understand the code, and thus it won’t even be able to run it.
But let’s say you don’t make any syntax mistakes and you creat a program, that let’s user add a next number in an array of size 10 each time he presses a button. The program is running, and first 10 times it runs fine. But then when user tries to add the 11th number, a runtime error will occur.
Program initially looked fine for the compiler, but you as a programmer have to also predict and handle errors.
Error handling is just as important as writing the core functionality. You need to predict that e.g. when a user tries to open a file, this file might not open properly for some reasons beyond the program’s scope.
Long story short, you’re releasing your baby program into a wild world and you need to protect it as well as you can from random shenanigans.