What is the value of ~0 in C?

后端 未结 7 1389
暖寄归人
暖寄归人 2021-01-02 10:22

I want to get the values of INT_MIN and INT_MAX. I\'ve tried ~0 and ~0 >> 1 since the leftmost bit is a sign bit bu

相关标签:
7条回答
  • 2021-01-02 11:00

    The value of an all bit set int depends on the sign representation that your platform has for int. This is why the macros INT_MIN and INT_MAX were invented, there is no way of computing these values in a portable way.

    0 讨论(0)
提交回复
热议问题