Become a leader in the IoT community!
Join our community of embedded and IoT practitioners to contribute experience, learn new skills and collaborate with other developers with complementary skillsets.
Join our community of embedded and IoT practitioners to contribute experience, learn new skills and collaborate with other developers with complementary skillsets.
Write a C function to swap all odd and even bits in an unsigned integer. Bit positions 0, 2, 4, … are considered even bits, and positions 1, 3, 5, … are odd bits.
Ex input: 10101010 (in binary),
Expected O/P: 01010101.
It may look simple at first, well, like just outputting its complement, but is that right?
What if the input is 11010010?
How would you proceed with this question?
CONTRIBUTE TO THIS THREAD