int x = 5 / 0; // Undefined behavior
0 is mathematically undefined, and as such it makes sense that this is undefined behavior.
float x = 5.0f / 0.0f; // x is +infinity
Most implementation implement IEEE-754, which defines floating point division by zero to return
NaN (if numerator is
infinity (if numerator is positive) or
-infinity (if numerator is negative).