在C做逻辑运算结束时,如果一个||的一面是真的? [英] In C does the logical operator end if one side of a || is true?
本文介绍了在C做逻辑运算结束时,如果一个||的一面是真的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在C语言中有以下几点:
In C have the following:
return (abc(1) || abc(2));
如果 ABC(1 == 1)
收益真正
然后将调用 ABC( 2)
?
推荐答案
ABC(2)
将被称为只有当 ABC(1)
是假
据C99规范,逻辑OR运算符说:
According to C99 specification, logical OR operator says
该||左到右的运营商保证评价;还有就是第一个操作数的评估后的序列点。如果第一个操作数比较不等于0,第二个操作数不计算。
The || operator guarantees left-to-right evaluation; there is a sequence point after the evaluation of the first operand. If the first operand compares unequal to 0, the second operand is not evaluated.
这篇关于在C做逻辑运算结束时,如果一个||的一面是真的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文