XOR operator in if

Asked

Viewed 25 times

0

Hello,

What is the meaning/result of the operator in the following if?

char ch, str[32];
if(str[inf - 1] == ch ^ str[sup -1] == ch) counter++;

I know that the goal is only one of the conditions is true, but I do not know how from an XOR we managed to achieve the result.

Thank you.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.