3 votes 3 votes #include <stdio.h> int main() { unsigned int m = 0; m |= 0xA38; printf("%x\n",m|(m-1)); printf("%x\n",( (m|(m-1)) + 1 ) & m ); } Find the output ? Programming in C programming-in-c bitwise + – dd asked Jun 27, 2017 dd 533 views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
1 votes 1 votes lemme know if i m wrong.... akash.dinkar12 answered Jun 27, 2017 akash.dinkar12 comment Share Follow See all 3 Comments See all 3 3 Comments reply dd commented Jun 28, 2017 reply Follow Share output is absolutely correct @akash. But you need to give a generalized statement of those two compound operation. 0 votes 0 votes akash.dinkar12 commented Jun 28, 2017 reply Follow Share @Debashish, I m not getting the meaning of generalized statement????? 0 votes 0 votes dd commented Jun 28, 2017 reply Follow Share for example when $m > 1$ then the operation $m | (m-1)$ is setting the trailing zeros as $1$. 1 votes 1 votes Please log in or register to add a comment.