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

All QuestionsCategory: Cpp LanguageWhat is syntax of try and catch block in exception handling in Cpp?
Chetan Shidling asked 5 years ago

I need short information.

1 Answers
chetan shidling answered 5 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
}