1: #include <stdio.h> 2: #include "exception-local.h" 4: #define DIVISION_BY_ZERO 1001 6: int divide (int a, int b) { 7: if (b == 0) { 8: throw (DIVISION_BY_ZERO); 9: } else { 10: return a/b; 11: } 12: } 14: int main (int argc, char **argv) 15: { 16: int i, j; 18: try { 19: printf ("%d\n", divide (100, 0)); 20: } except { 21: on (DIVISION_BY_ZERO) { 22: printf ("Caught up division by zero.\n"); 23: exit (0); 24: } 25: } 26: return 0; 27: }