Following this tweet about the lack of logical “xor” operators in many programming languages - one of the replies pointed to this c faq.
C has a logical XOR-operator, namely !=, provided you use only 1 and 0 as inputs.
if (func1(...) != func2(...)) { /* func1 or func2 succeeded or failed, but not both :P */ }
If not, you just add a !! in front of each.
if (!!(func1(...)) != !!(func2(...))) { /* func1 or func2 succeeded or failed, but not both :P */ }
C has a logical XOR-operator, namely !=, provided you use only 1 and 0 as inputs.
If not, you just add a !! in front of each.