Unsigned integers are always non-negative, that is, greater than or equal to 0. When you subtract 1 from 0 in an unsigned integer type, you get MAX_INT.
Therefore, the for loop will never be completed.
However, you need to use "% u" not "% d" in your printf if you want it to print an unsigned value, not a signed value.
Vicky source
share