Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C Programming
Why isn't there a logical XOR operator?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
Reply to thread
Message
[QUOTE="CBFalconer, post: 1699928"] #define _(x) !!(x) now your expression, including ensuring logical values, becomes: _(a) ^ _b) ^ _(c) ^ _(d) ^ _(d) ^ _(e) or a ^ b ^ c ^ d ^ e when the values are preknown to be logical, i.e. 0 or 1. In that case you can also use: (a + b + c + d + e) & 1 (and I believe the single _ to be a valid identifier) [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C Programming
Why isn't there a logical XOR operator?
Top