If we try to run this code:
int d = 10/0;
We get a compiler error. So we cannot divide by zero.
Now consider this code:
<
In the first instance, you have two constants, and so the compiler resolves this at compile time, thus finding the error.
In the second instance, as you have a non const
variable(d), the compiler does not resolve this at compile time as it has no way of ensuring the value of d
and thus will not spot the error. This will be evaluated at run time, where it will error out.