4 ms·
C does have a logical XOR, it's the `!=` operator. Unlike other logical operators, it requires the arguments to be normalized to a single truth value. It plays
by wat10000 2y ago
C does have a logical XOR, it's the `!=` operator. Unlike other logical operators, it requires the arguments to be normalized to a single truth value. It plays nicely with C's convert-to-boolean operator `!!`.
- wslh 2y ago^ ?
- 201984 2y agoThat's bitwise, not logical.
- 8n4vidtmkvmk 2y agoThat's bitwise xor
- Findecanor 2y agoI once failed a a test at a job interview because I hadn't realised that (even after having been programming for twenty years).
- gblargg 2y agoNo need for the second !: !foo != !bar
- wat10000 2y agoTrue, but you might confuse people if you use a nonstandard construct like this.