#include
int main(void)
{
int i=1,j=-1;
if((printf(\"%d\",i))<(printf(\"%d\",j)))
printf(\"%d\",i);
else
printf(\"%d\",j);
For -1
number of characters printed is 2
hence if condition is satisfied.
I think it is rather obvious: '1' is one character, '-1' is two. One is less than two.
Because printing j prints "-1", that's two characters. so 1<2 is true.
printf returns the number of characters (not just digits) written.
So printf("%d",-1)
will return 2
not 1
Similarly printf("%d",1)
will return 1
Making the condition in the if
true.