From the course: Debugging in C++ with Visual Studio Code

Unlock this course with a free trial

Join today to access over 24,700 courses taught by industry experts.

Logical errors

Logical errors

- [Instructor] All right, getting compiler and runtime errors out of the way is great. So your code is being understood by the compiler and it's not breaking anything. However, the code may not be exactly what you meant. These inconsistencies are known as logical errors. Logical errors don't always cause the program to crash, but the output or behavior of the program will be incorrect. Common causes include incorrect formulas, flawed algorithms, or wrong assumptions in the code. These errors often go unnoticed until you carefully test or validate the output. Sometimes these errors are detected by users after months of use, and so they need to be corrected in a software update. Common approaches to identify and resolve logical errors include step-by-step debugging, unit tests, and input output validation.

Contents