what is function of |= operator in C++?
like if we write a |= b;
what does |= do here?
thanks.
Printable View
what is function of |= operator in C++?
like if we write a |= b;
what does |= do here?
thanks.
If we assume that a and b are integer, then a |= b is the same as a = a | b, which is a bitwise or - so all bits that are set in b gets set in a as well.
--
Mats
Read the tutorial on bitwise operators. a |= b is short hand for a = a | b.