#include<stdio.h>
int main(void)
{
int a=-3,b=5,c;
c=a|b;
printf("%d ",c);
c=a&b;
printf("%d ",c);
}
The output is -3 5, please explain how?
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.
Binary of
5–is–>0000 01013 --> 0000 0011—1's Complement–>1111 1100—2's Complement (add 1)–>1111 1101== -3. This is how it gets stored in Memory.Bitwise OR Truth Table:
1111 1101|0000 0101=1111 1101== -3Bitwise AND Truth Table:
1111 1101&0000 0101=0000 0101== 5Also, see – What Every Computer Scientist Should Know About Floating-Point Arithmetic.