Can anyone please help me. What will be the answer of let's say x is a number then what will be answer of (-x & x). please tell i know that if +x's binary is 0111 then -x's binary will be 1111 and their bitwise and will be +x but i am getting different answer.please help me.

And thanks in advance.

Refer to this link : Tutorial

Bro (x & -x) just withdraws the last set bit of x;

For example x = 0110

So x&-x = 0010

Say the first 1 is at the ith position from LSB side of binary representation of x, then the very expression will be equal to 2^(i-1) where i is based on 1 indexing.

if x is 0111 then its 1's complement is 1000. After adding 1 to 1's complement you will get 1001. So -x is 1001 and doing & operation with x it will give 0001. So expression (x & -x) gives first location of 1 in x from LSB side.