- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我不确定这个右移怎么等于0:我明白移位是如何工作的,但为什么作者说它在二进制零中等于而在十进制中却有不同的结果?二进制零和十进制零不一样吗?
0000
还有它怎么等于二进制零?
unsigned int value = 65372U;
As a binary value in a 2-byte variable, this is:
1111 1111 0101 1100
Suppose you now execute the following statement:
unsigned int result = value >> 2; /* Shift right two bits */
The bits in value will be shifted two places to the right, introducing zeros at the left end, and the resultant value will be stored in result. In binary this will be 0, which is the decimal value 16343.
0011 1111 1101 0111
最佳答案
你的假设是正确的。二进制 0 与整数 0 相同。这本书往好了说是打印错误,往坏了说是完全错误。不过,它的示例似乎还不错。
另外,郑重声明,二进制 0 就是您所期望的:
0000 0000 0000 0000
0011 1111 1101 0111
不等于 0。
关于c - "Beginning C from Novice to Professional"中右移的用法误区,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54714703/
我正在做一个项目,我的 android 在这个项目中作为一个网络服务器工作;输入带端口号的 IP 地址,打开 Web 界面,用户可以将文件上传到手机。我想在 Web 界面上显示一些图片,以便我们的界面
我是一名优秀的程序员,十分优秀!