if statement operator "&"

Hi, I was working on chapter 11 of "C++ A Beginners guide, 2nd ed.", and in one of the examples (with working on the IO streams's flags), I came across this if statement:

1
2
3
4
5
6
f = cout.flags();

if (f & ios::showpos)
    cout << "showpos is set for cout.\n";
else
    cout << "showpos is cleared for cout.\n";


I want to know what that "&" is doing in the start of the if statement. Doesn't that mean it's trying to get the reference of something?
It's bitwise &. In this case it combines flags. You can check out the specifics in the documentation on this website.
Bitwise and (&) is like logical and (&&) the difference is that it performs the operation to each pair of bits
eg: ( random bit pattern )
01100101 &
00110110  
00100100
Topic archived. No new replies allowed.