what is function of |= operator in C++?
like if we write a |= b;
what does |= do here?
thanks.
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
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
Read the tutorial on bitwise operators. a |= b is short hand for a = a | b.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)