我想做一些練習,但我堅持在這一點上,我不明白髮生了什麼事情,找不到任何與此特定事項有關的東西(找到其他東西關於邏輯運算符,但還不夠)邏輯運算符和位操作C
編輯:爲什麼downvote,我很明確。沒有關於X的類型的信息,但我認爲是INT,大小也沒有描述,我想我會通過做練習發現。
a) At least one bit of x is '1';
b) At least one bit of x is '0';
c) At least one bit at the Least Significant Byte of x , is '1';
d) At least one bit at the Least Significant Byte of x , is '0';
我有解決方案,但將是巨大的,以瞭解他們
a) !!x // What happens here? The '!' Usually is NOT in c
b) !!~x // Again, the '!' appears... The bitwise operand NOT is '~' and it makes the int one's complement, no further realization made unfortunately
c) !!(x & 0xFF) // I've read that this is a bit mask, i think they take in consideration 4 bytes in X, and this applies a mask at the least significant byte?
d) !!(~x & 0xFF) // Well, at this point i'm lost ...
我希望不必在大學逃課,但我全職工作,以支付費用: (
'x'的類型是什麼? – Angew
http://stackoverflow.com/questions/10307281/c-operator-is-a-two-not – Mat
相信我,如果有關於X的類型的任何信息,我會把它。這裏沒有任何信息! –