+ 1
ASSIGNMENT OPERATORS
How do these assignment operators work in C++ (kindly use examples): a)&= b)|= c)^= d)<<= e)>>=
6 Réponses
+ 1
do you need assembly equivalent?
+ 1
These are all basically bitwise assignment operators
1. A &= B is equal to A = A & B (AND)
2. A |= B is equal to A = A | B (OR)
3. A ^= C is equal to A = A ^ B (XOR)
4. A <<= B means A = A << B (Binary Left Shift)
5. A =>> B means A = A >> B (Binary Right Shift)
Examples :
Left hand side = A
Right hand side = B
1. 255 &= 128= 128
2. 255 |= 10 = 255
3. 255 ^= 100 = 150
4. 1 <<= 1 = 2 (0b00000010)
5. 128 >>= 1 = 64 (0b01000000)
0
Yaroslav Vernigora your links are really helpful before I knew some but not all of them but now ,it all clears.
0
On!oN have you tried to search for such links yourself? I found them in a search engine in five seconds. or are search engines not running in your country?
0
@Prashanth Kumar if it will clearly explain how the above operators work.