Exception Handling
This blog has been migrated to learn c programming for beginners In this article, you will learn about Exception Handling in C++ and which handle run time error. Exception Handling is the mechanism that separate the code that detects and handle exceptions at run time from rest of program C++ exception handling is built upon three keywords: try, catch, and throw. Exception Handling vs Traditional Error Handling Following are main advantages of exception handling over traditional error handling. 1) Separation of Error Handling code from Normal Code: In traditional error handling codes, there are always if else conditions to handle errors. These conditions and the code to handle errors get mixed up with the normal flow. This makes the code less readable and maintainable. With try catch blocks, the code for error handling becomes separate from the normal flow. 2) Functions/Methods can handle any exceptions they choose: A function can throw many exceptions, but may choose to handle s...