What is exception;
Basically, run time error is called as exception
Exception handling:
Exception Handling in C++ is a process to handle run-time errors. We perform exception handling so the normal flow of the application can be maintained even after runtime errors.
Advantage:
It maintain the flow of the program.
Example-
-divisible by zero is the exception in mathematics so that it can't be resolve in the programs but it can be handled in C++.
Exception handling keyword:
try
catch
throw
Try:
We put that part of program inside the try block in which there is a chance of exception or error.
Catch:
If there is an exception in try block then control goes on Catch block.
Throw:
It is used to create a program exception.