symbol &

Hello,

What is the meaning of

 
  (1&3)


Have you some example where it is good to use such a condition?

Thanks
It's a bit wise AND.
For example to determine whether an integer value is odd or even.

1
2
if ( x & 1 ) std::cout << "x is odd\n";
else std::cout << "x is even";
Topic archived. No new replies allowed.