^ XOR
Returns true, if and only if, one of the operands is true.
| A | B | ^(XOR ) Operator |
| 0 | 0 | 0 |
| 0 | 0 | 0 |
| 1 | 0 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
| 1 | 1 | 0 |
| 0 | 0 | 0 |
| 0 | 1 | 1 |
~ Complement operator
The ~ operator performs a bitwise complement operation on its operand, which has the effect of reversing each bit. Bitwise complement operators are given below.
<< Binary Left Shift Operator
The number of bits specified by the right operand moves the left operands value left. The left-shift operator (<<) shifts its first operand left by the number of bits specified by its second operand. The type of the second operand must be an integer or a type that has a predefined implicit numeric conversion to int. Thus, for example, 37 << 3 is shifting the number 37 to the left by 3 places. Of course, we are working with the binary representation of 37. The binary form of 37 is
00100101. After sliding by 3 to the left, we are left with
00101. However, we need to add three 0's to complete the bit
00101000.
>> Binary Right Shift Operator
The number of bits specified by the right operand moves the left operands value right. The right-shift operator (<<) shifts its first operand left by the number of bits specified by its second operand. The type of the second operand must be an integer or a type that has a predefined implicit numeric conversion to the integer. For example, 37 >> 3 is shifting the number 37 to the right by 3 places. Of course, we are working with the binary representation of 37
The binary form of 37 is
00100101. After sliding by 3 to the left, we are left with
00100. However, we need to add three 0's to complete the bit
00000100. Hope, the tutorial was helpful. Happy coding.
Join the conversation! Your thoughts help the community grow.