What is syntax of try and catch block in exception handling in Cpp?


Warning: Trying to access array offset on false in /home3/indiakep/public_html/wp-content/plugins/dw-question-answer/inc/Template.php on line 8
All QuestionsCategory: Cpp LanguageWhat is syntax of try and catch block in exception handling in Cpp?
Chetan Shidling asked 6 years ago

I need short information.

1 Answers
chetan shidling answered 6 years ago

The general syntax of try/catch block is
 
try
{
      //statements
}
 
catch (datatype1 identifier)
{
    //code to handle the exceptions
}
 
catch (datatype2 identifier)
{
    //code to handle the exceptions
}