【发布时间】:2013-09-27 07:33:08
【问题描述】:
我对其中一些操作感到困惑(组合按位和逻辑操作)。
如果 x = 0x3F 和 y = 0x75,求 diff c 表达式的字节值:
1) x&y
2) x | y
3) ~x | ~y
4) x & ~y
5) x && y
6) x || y
7) !x || !y
8) x && ~y
尝试
首先,我将十六进制转换为二进制:
x = 00111111
y = 01110101
这是我的尝试
1) 00110101
2) 01111111
3) 01111111
4) x & not y? isn't the bang operator a logical operator? what is the bit representation of !y?
5) x && y = TRUE = but how is that represented as a byte? 11111111?
6) x || y = how can this be represented as a byte?
7) !x || y = ???
8) x && ~y = ?????
【问题讨论】:
-
您对 3 的回答是错误的。
~x有一个第一位,所以~x | ~y也必须。
标签: c binary bit-manipulation bit logical-operators