clarification of int & int inside a if statement in C++
This question already has an answer here:
It will result in an entire integer. When you use the bitwise and, each bit of the two values are and'ed together, and each bit in the result is set accordingly. The result will be the same number of bits as the values being and'ed together.
This is assuming you're using two integer variables.
Assuming mask
is a pointer to an integer type the compiler will do the following:
i
-th element of the mask
"array" as an integer AND
AND
operation the value will be treated as true
, otherwise as false
(if every single bit of the result is 0
) 上一篇: 在C语言中使用&(AND)运算符是什么?