There can be more than one exception handler (or catch block) for one
try block, because it might so happen that in one single try block there can be
different types of exceptions that can be thrown.
This is shown in the
following code snippet:
try
{
{
// statement that throws
divide-by-zero exception
// statement that throws array out-of-bound exception
// statement that throws array out-of-bound exception
}
catch ( divide_error id1 ){ // code }
catch ( out_of_bound_error id2 ){ // code }
catch ( divide_error id1 ){ // code }
catch ( out_of_bound_error id2 ){ // code }
c language sample program codes to beginner programmers
ReplyDeleteguess my number c game code