What is bitwise operator and how it used? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

What is bitwise operator and how it used?

?

1st Jan 2017, 6:49 AM
mahesh naandade
mahesh naandade - avatar
2 Answers
+ 2
bitwise operators are used in testing conditions like " &&, &, || , == " .
1st Jan 2017, 6:59 AM
Wen Qin
Wen Qin - avatar
+ 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
1st Jan 2017, 8:16 AM
Ihab Taleb
Ihab Taleb - avatar