Even if we declare float a=5.6
then printf("%d",sizeof(!a))
outputs 2
.
Why does it output size of integer?
The !
operator returns an integral type, likely int
. sizeof(int) == 2
on your architecture, apparently.
The !
operator doesn't return the type of the operand. If you perform a NOT on a float
, you're not going to get a float
back. You are going to get an int
with the logically opposite value of the initial float
.
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