如果 x=10 y=10 z=5 x<y<z=true 怎么办? [英] if x=10 y=10 z=5 how is x<y<z=true?
本文介绍了如果 x=10 y=10 z=5 x<y<z=true 怎么办?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这个问题&在答案中,它说由于从左到右的关联性,结果将是 1,这对于这个陈述是正确的.这是代码.
I have this question & in the answer it says that due to left to right associativity the result would be 1 that is true for this statement. This is the code.
#include<stdio.h>
int main ()
{
int i=0,x=10,y=10,z=5;
i=x<y<z;
printf("
%d",i);
return 0;
}
但是这里的 x 大于 z,这是怎么回事?
But x is greater than z here so how is this happening ?
推荐答案
表达式 x
(x < y) < z
原来如此
(10 < 10) < 5
进一步评估为
0 < 5
这是真的.
我想你想要这样的东西:
I think you wanted something like this:
x < y && y < z
这篇关于如果 x=10 y=10 z=5 x<y<z=true 怎么办?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文