How -1 is greater than 4?

Explain why output is “-1 is greater than 4”?

CODE:

#include<stdio.h>

int main()
{
printf("%d",sizeof(int));
if(sizeof(int)>-1)
{
printf("nn 4 is greater than -1");
}
else
{
printf("nn -1 is greater than 4");
}
return 0;
}



OUTPUT:

 4

-1 is greater than 4

2 thoughts on “How -1 is greater than 4?

Leave a Reply