It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center
                            
                        
                    
                
                                9年前关闭。
            
                    
int main()
{
    signed int bit=512, mBit;
    {
        mBit = ~bit;
        bit = bit & ~bit ;
        printf("%d %d", bit, mBit);
    }
    return 0;
}


一种。 0,0
  b。 0,513
  C。 512,0
  d。 0,-513

伙计们,我没有这个问题的答案,也无法解释这个问题。所以,请您提供正确解释的答案。

最佳答案

正确答案是d:http://ideone.com/frKOz


该位为0,因为bit & ~bit始终为零(1000000000 & 0111111111)。
mbit是-513,因为反相512是-513。


编辑:为什么mbit -513?

请参见带符号整数处理的说明:http://www.rwc.uc.edu/koehler/comath/13.html

10-06 00:40