What happens if an exception is thrown but not caught in a C++ program?
- The program continues normally.
- The program crashes.
- The exception is ignored.
- The exception is retried.
When an exception is thrown but not caught in a C++ program, it leads to the termination of the program. This is because unhandled exceptions indicate unforeseen errors, and the program cannot predict how to safely continue in such cases.
Loading...
Related Quiz
- The conditions in a switch-case statement must be of _______ data type.
- In C++, the return statement cannot be used inside a _______.
- What is the primary advantage of passing parameters by reference over passing them by value?
- How does the short-circuit evaluation work in logical operators?
- What does the struct keyword allow a C++ programmer to do?