eblc1388 said:
Joel Rainville said:
The unary NOT operator is !, and of course the != operator isn't a bitwise operator, but a comparison operator meaning "different than"...
So "!=" is the XOR instruction in C then?
It is already mentioned that
! is a unary operator. This means it will only invert 0 to 1 and 1 to 0.
But that is true only if the data is in bytes
This means if you write 0XFF != a, then a will contain 0 and if you again invert it by saying
!a then the answer will be
1
in binary
!(0000 0000) = (0000 0001)
whereas if you use
~ then it will simply invert each bit as it is a bitwise operator.
NOT operators are unary ie operate on single bit or byte