It prints false
because of signed/unsigned mismatch in the comparison.
The result of sizeof
is a size_t
value, which is unsigned. When the int
value -1
is compared to that, the integer is interpreteted as a very large unsigned value.
The C99 draft standard expresses this like so:
Otherwise, if the operand that has unsigned integer type has rank greater or
equal to the rank of the type of the other operand, then the operand with
signed integer type is converted to the type of the operand with unsigned
integer type.
Here, the size_t
is at least unsigned int
which makes it rank equal to or out-rank int
, and thus cause the int
to be converted to size_t
.
Also, main()
really does return int
, I don't understand why you edited that out.