-
What is the output of this program?
#include <iostream>
using namespace std;
void Example(int n)
{
try
{
if (n > 0)
throw n;
else
throw 'L';
}
catch(char)
{
cout << "Catch a integer and that integer is :" << n;
}
}
int main()
{
cout << "Testing multiple catches :";
Example(5);
Example(0);
}
-
- Catch a integer and that integer is : 5
- Compilation Error
- Testing multiple catches :
- Runtime Error
- None of these
Correct Option: C
As the catch is created with a wrong type, So it will arise a runtime error.