Below is sample program to demonstrate how to use exception handling.
35 static void randomly_throw_exception()
41 static void *my_malloc(
size_t size)
43 void *ptr = malloc(size);
49 static int test_exception()
54 void *data = my_malloc(200);
56 randomly_throw_exception();
62 printf(
"Caught exception %d (%s)\n",
80 return test_exception();