! C运算符,是一个两不呢? [英] !! c operator, is a two NOT?
本文介绍了! C运算符,是一个两不呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我读这 code 和这行
switch (!!up + !!left) {
什么 !!
运营商?两个逻辑NOT?
what is !!
operator ? two logical NOT ?
推荐答案
是的,它是由两个穷人。
yes, it's two nots.
!!一个
是 1
如果 A
是非零和 0
如果 A
是 0
!!a
is 1
if a
is non-zero and 0
if a
is 0
您可以把 !!
作为夹紧,因为它是,到 {0,1}
。我个人觉得使用一个坏的尝试出现看中。
You can think of !!
as clamping, as it were, to {0,1}
. I personally find the usage a bad attempt to appear fancy.
这篇关于! C运算符,是一个两不呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文