bitwise not operator

前端 未结 10 995
广开言路
广开言路 2021-01-30 16:24

Why bitwise operation (~0); prints -1 ? In binary , not 0 should be 1 . why ?

10条回答
  •  清歌不尽
    2021-01-30 17:08

    0 here is not a bit. It is a byte (at least; or more) - 00000000. Using bitwise or we will have 11111111. It is -1 as signed integer...

提交回复
热议问题