Question: Printing bits iteratively Write a function that accepts as input an unsigned char and prints the bits of the character. The function should print the

 Printing bits iteratively Write a function that accepts as input an

Printing bits iteratively Write a function that accepts as input an unsigned char and prints the bits of the character. The function should print the bits iteratively (namely using a "for loop"). The function needs to print the bits that the MSB (bit 7) is printed first. Use the following statements when printing: 1. To print a O use-printf("0"); 2. To print a 1 use printf("1"); 3. To go the next line use printf(In"); Note that you can combine the new line with any other 4. printing statement e.g., to print a 0 on the screen and skip to the next line use printf("OIn"); For example if the c is 'A' then the function output should be 01000001 Function prototype void printBitslterative(unsigned char c); Instructions: Here the function will need to iterate on all the bits. There are several ways of accomplishing it. Below is one way of doing it. Option 1: Here you will use the isBitSet() function that you coded. 1. Loop (using a for loop) on all the possible bits (bits 0-7) and check each bit whether it is set a. If the bit is set, then print a 1 otherwise print a 0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!