Where is the logical operator xor
?
// Return 1 when either A or B is 5
return (A==5) ^^ (B==5);
I want to write it like this, but there is no ^^
operator, but there is only a bit operator ^
.
There are &
, &&
, |
, and |
but how do I write ^^
?
There is no logical ^^
but !=
does that
The fact that they'really?
A != B
To,
If the two are not the same bool
value,
!A != !B
It has to be written as.
As you asked, if you want to return 1 when either A or B is 5,
return (A==5) != (B==5)
It has to be written as.
© 2024 OneMinuteCode. All rights reserved.