Exceptions in C use try and catch blocks as well as throw st
Solution
If a function needs to throw an exception, then
The structure of try, throw and catch
ReturnTYpe functioName(type arguments)
{
Statements;
try {
statements;
throw exception;
statements;
} // closing of try
catch(type exception)
{
Statement to handle exception;
}
Remaining statement of function
} // closing of function
N.B: you can add multiple catch blocks as needed.
