0
I want an explanation to this code: What is it "|"
1|2 is 3 10|20 is 30 100|200 is 236
3 Answers
+ 24
It's bitwise OR operator. It converts both the operands to equivalent binary numbers and checks bit by bit. If any of the bit is 1, it'll give 1.
1|2
= 01 | 10
= 11
= 3
10|20
= 01010 | 10100
= 11110
= 30
+ 3
For sets, it is the union operator (outputs all elements that are in A or in B or in both)
+ 2
Thanks a lot :-)