8. (C) Show the implementation of exception handling for using the pointers.

8. (C) Show the implementation of exception handling for using the pointers.
Show the implementation of exception handling for using the pointers.

#include <iostream> 
using namespace std; 

int main() 

int x = -1; 

// Some code 
cout << "Before try \n"; 
try { 
cout << "Inside try \n"; 
if (x < 0) 

throw x; 
cout << "After throw (Never executed) \n"; 


catch (int x ) { 
cout << "Exception Caught \n"; 


cout << "After catch (Will be executed) \n"; 
return 0; 



8. (C) Show the implementation of exception handling for using the pointers. 8. (C) Show the implementation of exception handling for using the pointers. Reviewed by admin on December 23, 2019 Rating: 5

No comments:

Powered by Blogger.