!! c operator, is a two NOT?

c, logical-operators, operators

Solution

yes, it's two nots.

`!!a` is `1` if `a` is non-zero and `0` if `a` is `0`

You can think of `!!` as clamping, as it were, to `{0,1}`. I personally find the usage a bad attempt to appear fancy.

Problem

I reading this code, and have this line ``` switch (!!up + !!left) { ``` what is `!!` operator ? two logical NOT ?

Original source

Related problems