What's this =! operator?

c, c++, operators

Solution

That's two operators, `=` and `!`, not one. It might be an obfuscated way of writing

a = !b;
if (a) {
    // whatever
}

setting `a` to the logical inverse of `b`, and testing whether the result is true (or, equivalently, whether `b` was false).

Or it might be a mistyping of `a != b`.

Problem

I was surprised by this code: ``` if (a =! b) { // let it be on false ... } ``` But `a` is never assigned by a value. What's this operator about?

Original source

Related problems