We know that `sizeof(int) = 4`

and `4 > -1`

is true so the expected output of the following piece of code is true.

However, it's printing "False". Why is wrong?

```
#include <stdio.h>
main(){
if (sizeof(int) > -1)
printf("True");
else
printf("False");
}
```

# Best How To :

Operator `sizeof`

returns a value of some unsigned integral type that has typedef name `size_t`

. For example it can be `unsigned long`

But in any case the rank of `size_t`

is not less than the rank of `int`

.

According to the rules of usual aruthmetic conversions (the C Standard, 6.3.1.8 Usual arithmetic conversions)

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.

So in this expression of the if statement

```
if (sizeof(int) > -1)
```

integer constant `-1`

that has type `int`

is converted to type `size_t`

and has value `SIZE_MAX`

.

`SIZE_MAX`

is greater than 4 (or something else that corresponds to sizeof( int )) returned by the `sizeof`

operator. Thus the above statement may be rewritten like

```
if (sizeof(int) > SIZE_MAX)
```

and it yields `false`

.

Take into account that you could prevent the conversion of the integer constant if its rank would be greater than the rank of `size_t`

. For example try the following if statement

```
if (sizeof(int) > -1ll)
```

in this case if `size_t`

is not defined like `unsigned long long`

then the result of evaluation of the expression will be equal to `true`

as you expected.

Here is a demonstrative program

```
#include <stdio.h>
int main(void)
{
if ( sizeof( int ) > -1 )
{
puts( "True" );
}
else
{
puts( "False" );
}
if ( sizeof( int ) > -1ll )
{
puts( "True" );
}
else
{
puts( "False" );
}
return 0;
}
```

Its output is

```
False
True
```