I try to run a code, but I cannot understand what throw statement do in this part, I thought that we can use ´throw´ statement in try-catch block. any can help me with this example:
switch(npt) {
case 1: {
a = NPoint1;
b = NLine1;
break;
}
.
.
.
case 5: {
a = NPoint2;
b = NLine2;
break;
}
default:
printf("what you entered is wrong");
throw 1;
};
return 1;
}
thanks in advance for any help
throw
is catched by the nearest try-catch
block. If it's not in your own code, it's in the code that invoked your's and so on up the stack.