x使用合法运算符检查数字是否为非零值!.
x
!
例如:isNonZero(3) = 1,isNonZero(0) = 0
isNonZero(3) = 1
isNonZero(0) = 0
法律行动: ~ & ^ | + << >>
~
&
^
|
+
<<
>>
if
else
for
int
int isNonZero(int x) { return ???; }
使用!它将是微不足道的,但我们如何不使用!?
c bit-manipulation
bit-manipulation ×1
c ×1