How & works when
int num1=10,num2=9;
int res=num1 & num2; // where num1 and num2 are integers
the value of res=8; How it is working
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The
&is a bitwise-AND operator. Each bit in the result is set only if the corresponding bit is also set in both num1 and num2.It may make more sense if you write the numbers in binary: