Question.3
A developer checks whether both bit 0 and bit 7 are set in a flags register. He writes:
if (flags & 0x01 && flags & 0x80) {
Another developer suggests replacing && with &. Would the logic remain the same?
&&
&
Select Answer
Yes — both always produce the same result
No — gives a completely different result than the original logic
Yes — both are not interchangeable but this scenario gives same logical output.