As arithmetic operator has higher precedence than shifting operator , mask
will have 5th bit zero from left.

So it will deduct 16 from the input if 5th bit is set in the binary
representation of number.
so it will deduct 16 from 56 and 127..............but not from 64....

But its  just the procedural thing ....meaning i don't know......


On Sat, Nov 24, 2012 at 2:15 PM, rajesh pandey <rajesh.pandey.i...@gmail.com
> wrote:

> void dosomething(int num)
> {
> int mask=~(1<<5-1);
>  int res=num&mask;
> printf("%d",res);
> }
> int main()
> {
> dosomething(56);
> dosomething(64);
> dosomething(127);
>  return 0;
> }
>
> please explain  the logic behind the output.
>
> Thanks,
> Rajesh
>
> --
>
>
>

-- 


Reply via email to