What is run time error? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is run time error?

20th Jun 2022, 3:42 PM
EmmzyCodez
EmmzyCodez - avatar
2 Answers
+ 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)
20th Jun 2022, 4:19 PM
Alexander Thiem
Alexander Thiem - avatar
+ 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.
20th Jun 2022, 5:05 PM
Nick