是什么〜0呢? [英] What does ~0 do?

查看:113
本文介绍了是什么〜0呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


请问〜0意味着其翻转000000000 1111111111?

 的printf(请检查:%I,〜0);

的printf的结果为-1,这就是为什么我很困惑。
结果
-1是否意味着基本上同样的事情11111111111111111位?


解决方案

  

请问〜0意味着其翻转000000000 1111111111?


是的,是的。


  

-1是否意味着基本上同样的事情11111111111111111位?


二进制补重新presentation,它的作用。


Does ~0 mean its flipping 000000000 to 1111111111?

printf("Check: %i", ~0);

The printf results to -1, which is why I am confused.
Does -1 essentially mean the same thing as 11111111111111111 bits?

解决方案

Does ~0 mean its flipping 000000000 to 1111111111?

Yes, it does.

Does -1 essentially mean the same thing as 11111111111111111 bits?

In 2s complement representation, it does.

这篇关于是什么〜0呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆