0

Can someone describe the bitwise operator (&) in a for loop? Like: int bitNum=0b01010101;for (i=0b00000000; i &bitNum; i++)

17th Aug 2016, 4:16 PM
Lkas
1 Réponse
+ 1
Your for loop is invalid. there should be a condition after initialising and after 1st semicolon. Also & operator returns 0 if inputs are both 0 or (0,1) or (1,0) and returns 1 only if both values are 1. That's why the condition you put i &bitNum is plain wrong and moreover if it was a statement the answer would be 0b00000000 or 0x00
4th Sep 2016, 1:08 PM
Mohit Lamba
Mohit Lamba - avatar