You are viewing a single comment's thread. Return to all comments →
"&&" is Logical or Boolean Operator.Its called Logical (AND).
"&" is Bitwise Operator.Its called Bitwise (AND).
Logical (AND) "&&" can be used to compare different types of expressions.
:- Let a=10; b=5; c=0;
(a==10) && (b>a) -----> true && false ------> false so 0 (zero)
(a==10) && (b true && true ------> true so 1 (one)
a && b -----> true && true -----> true so 1 (one) a && c -----> true && false ------> false so 0 (zero)
Bitwise (AND) "&" is used on integers only and they are used for operations on individual bits.
Let a== 3 --> 00000011 (In Binary); b== 5 = 00000101 (In Binary);
3 --> 00000011 (In Binary) 5 --> 00000101 (In Binary) -------------------------------------------
& 00000001 (In Binary) so 1 (one)
:-) keep smiling and solve problems...!
Seems like cookies are disabled on this browser, please enable them to open this website
Bitwise Operators
You are viewing a single comment's thread. Return to all comments →
"&&" is Logical or Boolean Operator.Its called Logical (AND).
"&" is Bitwise Operator.Its called Bitwise (AND).
Logical (AND) "&&" can be used to compare different types of expressions.
:- Let a=10; b=5; c=0;
(a==10) && (b>a) -----> true && false ------> false so 0 (zero)
(a==10) && (b true && true ------> true so 1 (one)
Bitwise (AND) "&" is used on integers only and they are used for operations on individual bits.
Let a== 3 --> 00000011 (In Binary); b== 5 = 00000101 (In Binary);
& 00000001 (In Binary) so 1 (one)
:-) keep smiling and solve problems...!