Runtime Errors (original) (raw)
Last Updated : 6 Aug, 2025
Runtime Errors:
- A runtime error in a program is an error that occurs while the program is running after being successfully compiled.
- Runtime errors are commonly called referred to as _"bugs" and are often found during the debugging process before the software is released.
- When runtime errors occur after a program has been distributed to the public, developers often release patches, or small updates designed to fix the errors.
- Anyone can find the list of issues that they might face if they are a beginner in this article.
- While solving problems on online platforms, many run time errors can be faced, which are not clearly specified in the message that comes with them. There are a variety of runtime errors that occur such as **logical errors, **Input/Output errors, **undefined object errors, **division by zero errors, and many more.
Types of Runtime Errors:
Ways to avoid Runtime Errors:
- Avoid using variables that have not been initialized. These may be set to **0 on your system but not on the coding platform.
- Check every single occurrence of an array element and ensure that it is not out of bounds.
- Avoid declaring too much memory. Check for the memory limit specified in the question.
- Avoid declaring too much Stack Memory. Large arrays should be declared globally outside the function.
- Use return as the end statement.
- Avoid referencing free memory or null pointers.