+ 1

Can anybody please explain the output

#include<stdio.h> int main() { int b=5&6&7; printf("%d",b); } Output:- 4

20th Feb 2020, 2:00 AM
Jaswanth Kishore S
2 Respostas
+ 2
Bitwise and operator (&) takes two numbers as operands and does AND on every bit of two numbers. The result of AND is 1 only if both bits are 1. So as Jay Matthews explained the answer should be 4 as 101&110 =100 100&111 =100=4
20th Feb 2020, 2:09 AM
Arsenic
Arsenic - avatar
+ 1
Thnx
20th Feb 2020, 2:08 AM
Jaswanth Kishore S