• Post Reply Bookmark Topic Watch Topic
  • New Topic

assignment with & ...  RSS feed

 
zhewen
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
haiy all,
who can do some step hier, please

int n=7;
n<<=3;
n=n&n+1|n+2^n+3;

zhewen
thanks
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
here is the answer
int n=7;
in binary format last code are 0111
n<<=3; implies n= 111000 (8+16+32=56)
n=n & n+1 | n+2 ^ n+3
n=56 & 57 | 58 ^ 59
order of preference
+, & ,^ ,|
0 & 1= 56
58 ^ 59 =1
and the result 56 |1 is 57
the out put is 57
got it.
 
zhewen
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank u gouru
i located the mistake.
zhewen
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!