操作员在〜c语言编程 [英] Operator ~ in c programming language
本文介绍了操作员在〜c语言编程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何〜
在C运营商工作的?
How does ~
operator work in c?
任何人都可以解释以下code?
can anyone explain the following code?
main()
{
printf("%d",~5);
}
输出 -6
推荐答案
操作符〜在c是不是位操作符。所以,在你的例子
The ~ operator in c is the NOT bitwise operator. So, in your example
main()
{
printf("%d",~5);
}
将打印
-6
位进行如下。
5 = 0000 0101
5 = 0000 0101
当你把一个字节的不是你翻转所有的1和0使得新号
When you take the NOT of a byte you flip all the 1's and 0's making the new number
6 = 1111 1010
-6 = 1111 1010.
这篇关于操作员在〜c语言编程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文