C comparison char and int

前端 未结 6 1147
走了就别回头了
走了就别回头了 2020-12-06 03:13

In the code block below what\'s the impicit conversion that takes place in the if statement for 7? I would have though it would end up being (0x98 <= 0x07) but that\'s no

6条回答
  •  被撕碎了的回忆
    2020-12-06 03:53

    It will evaluate the same as 0x98 <= 7 unless the platform's char type defaults to signed and CHAR_BIT is 8. In that case, the value of minstogo will be negative and minstogo <= 7 will be true.

提交回复
热议问题