+ 1
find output with reason:- main() { if(sizeof(int)>-1) printf("Hello"); else printf("Hii") }
4 ответов
+ 3
I guess sizeof returns an unsigned integer. In that case, 4 < -1 because you're comparing unsigned and signed values.
That's why it's printing Hii
+ 6
sizeof(int) is of type size_t, which is an unsigned integer type. So in the expression if(sizeof(int) > -1), -1 is converted to an unsigned integer, which is very big.
+ 3
sizeof(int)=4 (signed)
and -1 =4,294,967,295(signed)
So 4>4,294,967,295 is false .
That's why its printing Hii.
0
why it is not so when i print the value of sizeof(int), it does not show any unsigned value. why??