CS Electrical And Electronics
@cselectricalandelectronics

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 4 years ago

I need short information.

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