+ 3
What is bitwise operator and how it used?
?
2 Réponses
+ 2
bitwise operators are used in testing conditions like " &&, &, || , == " .
+ 2
bitwise operators are only :
*)&(and) gives 1 if only the 2 bits are 1
*)|(or) gives 1 if one of them at least is 1
*)~(not) invert bits (ones complement)
*)^ (xor) gives 1 if only one of them is one
*)>>(right shift) value is moved right by the number of bits specified by the right operand.
*)<<(left shift) value is moved left by the number of bits specified by the right operand.
___________________________________________
those are binary operators(bitwise operators) . you can apply them only in binary form . for example :(15 &1) is :
1111
&
0001
_______
0001
___________________________________________
&& || ! == are logical operators used for testing conditions