bitwise not operator

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

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

10条回答
  •  死守一世寂寞
    2021-01-30 17:03

    For 32 bit signed integer

    ~00000000000000000000000000000000=11111111111111111111111111111111 (which is -1)

提交回复
热议问题