混淆输出 [英] Confusion about the output
本文介绍了混淆输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
#include<stdio.h>
int main(void)
{
int i=1,j=-1;
if((printf("%d",i))<(printf("%d",j)))
printf("%d",i);
else
printf("%d",j);
return 0;
}
由于的printf()
返回成功打印的字符数,病情将如果(1。1)
这是假的,但执行if部分和输出 1-11
。为什么会这样?
As printf()
returns the number of characters successfully printed, the condition will be if(1<1)
which is false but the if part is executed and the output is 1 -1 1
. Why this is happening?
推荐答案
我认为这是相当明显的:'1'是一个字符,-1为二。一个是小于2。
I think it is rather obvious: '1' is one character, '-1' is two. One is less than two.
这篇关于混淆输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文