no&1 ? cout << " odd " : << “even”
At 05:44 in ternary operator lecture ,what is the use of & . Tell me more about this operator
@anujsharmabadboy ‘&’ operator refers to the bitwise AND operator.
So, no&1 is the logical AND operation between no and 1. Lets say if value of no is 4. Its binary representation is 100. So no&1 is 100 & 001 which equals to 0. You will note that for odd values of no the result of no&1 is always 1 and for even values of no, it is always 0.
You will learn more about the bitwise operators in the bitmasking section of your course. To understand well you can refer that.
Hope this helps