按位与&和之间的区别是什么?和逻辑与 [英] What is the difference between Bitwise AND & and LOGICAL AND &&

查看:44
本文介绍了按位与&和之间的区别是什么?和逻辑与的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
逻辑和条件之间有什么区别AND,或C#中的OR?

按位与&和之间的区别是什么?和逻辑与&& ??

What is the difference between Bitwise AND & and Logical AND &&??

推荐答案

& 使用按位运算符(即)修改整数. 1000&1001 = 1000 & 比较布尔值.但是,& 兼用作非短路逻辑和,这意味着如果您具有 false&true ,第二个参数仍将被评估.&& 不会是这种情况.

& modifies integers with bitwise operations, ie. 1000 & 1001 = 1000, && compares boolean values. However, & doubles as the non-shortcircuiting logical and, meaning if you have false & true, the second parameter would still be evaluated. This won't be the case with &&.

这篇关于按位与&和之间的区别是什么?和逻辑与的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆