Example 96: Print Binary Value
Explore how to use bitwise operators to convert and print the binary equivalent of a one-byte number in C. Understand the step-by-step approach of checking each bit with bitwise AND and shifts to display the binary value correctly.
We'll cover the following...
We'll cover the following...
Problem
Define a showBits() function that would print the binary value stored in a one-byte entity.
Remember that you can only use bitwise operators to solve this challenge.
Example
| Input | Output |
|---|---|
| 10 |