0

Bitwise Operators

I know there are operators like & and | those work with binary numbers (convert from decimal to binary) But... Are there more operators? And... Is it easy to know the result without make the number binary? Pd: I saw the operator ^ in a challenge and I'm not sure what it's (I lost :p)

8th Jul 2017, 10:57 AM
Andrés04_ve
Andrés04_ve - avatar
5 odpowiedzi
+ 10
^ is xor operator. It gives 1 if the operands are different, and gives 0 if they are same. 0^0 = 0 0^1 = 1 1^0 = 1 1^1 = 0
8th Jul 2017, 11:37 AM
Shamima Yasmin
Shamima Yasmin - avatar
+ 6
more about bitwise operators in C/C++ (and in many other languages too) https://en.m.wikipedia.org/wiki/Bitwise_operations_in_C
8th Jul 2017, 11:39 AM
Eligijus Silkartas
Eligijus Silkartas - avatar
+ 2
yes
8th Jul 2017, 11:45 AM
Eligijus Silkartas
Eligijus Silkartas - avatar
+ 2
Okay, thanks a lot!
8th Jul 2017, 11:47 AM
Andrés04_ve
Andrés04_ve - avatar
+ 1
If the numbers are 6^10, it works like that: 0110 (6) 1010 (10) _________ 1100 (14) ?
8th Jul 2017, 11:43 AM
Andrés04_ve
Andrés04_ve - avatar