No, there is no difference. Both of those examples are exactly the same. From the C spec 6.5.3.3 Unary arithmetic operators:
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 type int
. The expression !E
is equivalent to (0==E)
.
Since nil
is 0, that last sentence applies exactly.