i had complete assignment qs up to 11.
int x=1;
printf(“\n %d”,~x|x);
output : -1
i had complete assignment qs up to 11.
int x=1;
printf(“\n %d”,~x|x);
output : -1
EmbLogic Research & Competency Development Labs
Phone: +91 9818467776, 8527567776, 9650467776
Email: info@emblogic.com
Copyright © EmbLogic Embedded Technologies Pvt. Ltd.
The program will be evaluated in this form: ((~x) | x)
i.e. In step1 the complement of X will become
11…..10
and also the value of x will not be updated with the same complement value hence
11…..10
| 00…..01
————–
11…..11
—————
and the value of 111….11 is -1 in two’s complement compiler.
Hence we are getting the value as -1
got it.
1111111111111111111 means -ve
then
000000000000000000
adding 1
000000000000000001