Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using a bitwise AND on more than two bits

I am pretty new to bitwise operators. Let's say I have 3 variables a, b and c, with these values in binary:

  a = 0001
  b = 0011
  c = 1011

Now, I want to perform a bitwise AND like this:

    a
AND b
AND c
--------
d = 0001

d &= a &= b &= c doesn't work (as I expected), but how can I do this? Thanks


1 Answers

What's wrong with just this.

d = a & b & c;
like image 109
CB Bailey Avatar answered Nov 24 '25 23:11

CB Bailey



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!