Can some one explain how it's get the first and second bit, so, how is (i&2)/2 getting the second bit ?
Code:
for(i=0; i < 4; i++) {
bit_a = (i & 2) / 2; // Get the second bit.
bit_b = (i & 1); // Get the first bit.
printf("%d | %d = %d\n", bit_a, bit_b, bit_a | bit_b);
}
Comment