About original code, inverse code, complement code

https://www.zhihu.com/question/20159860/answer/71256667

The one's complement does not change the sign bit, and bitwise inversion changes each bit.

The computer stores it in complement, and the inversion of -1 is exactly 0. Take while(~scanf()) as an example

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324991749&siteId=291194637