我搜索了标准但没有注意到提到的部分。
它只是“0 和 1 之外的任何东西”还是依赖于编译器?
最佳答案
The result of the logical negation operator
!
is 0 if the value of its operand compares unequal to 0, 1 if the value of its operand compares equal to 0. The result has typeint
.
出现在 C89/C90、C99 和 C11 中。
关于c - !0 在 C89 中保证为 1?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35440345/