Can someone explain to me how
printf("%d", -2<2u?1:-1);
prints out '-1'. I assume there is some kind of implicit conversion going on but I can't seem to grasp it.
-2
is getting converted to unsigned integer
. This will be equal to UINT_MAX - 1
, which is definitely greater than 2
. Hence, the condition fails and -1
is printed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With