int main (int argc, const char * argv[]) { <br>
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int a1,b1,c1;
@try {
NSLog(@"Enter numerator: ");
scanf("%i",&a1);
NSLog(@"Enter denomenator: ");
scanf("%i",&b1);
c1 = a1/b1;
NSLog(@"%i",c1);
}
@catch (NSException * e) {
NSLog([e name]);
NSLog([e description]);
NSLog([e reason]);
}
@finally {
NSLog(@"inside finally block");
}
[pool drain];
return 0;
}
Here if i enter value of a1=10, b1=0, then there should be exception generated, so statement within catch block will supposed to be execute. But it doesn't. Program crashed. Try..Catch doesn't work in this case ......Looks like i am doing something wrong...