Task

Write a function to detect a   divide by zero error   without checking if the denominator is zero.




integer
divide(integer n, integer d)
{
    return n / d;
}
 
integer
can_divide(integer n, integer d)
{
    return !trap(divide, n, d);
}
 
integer
main(void)
{
    if (!can_divide(9, 0)) {
        o_text("Division by zero.\n");
    }
 
    return 0;
}