1. Engineering
  2. Computer Science
  3. printing bits recursively write a recursive function that accepts as...

Question: printing bits recursively write a recursive function that accepts as...

Question details

Printing bits recursively Write a recursive function that accepts as input an unsigned char and using the functions above prints the bits of the character. In this printing scheme leading Os are not printed. Namely if c4 then the function will print 100. 5. For example if the c is A then the function output should be Function prototype void printBitsRecursive(unsigned char c); pseudo code: // base case-print the write most bit if c is either 0 or1 // if c is either O or 1 then print 0 or 1 depending on the state of the least significant bit (LSB) // recursive step // call the function recursively while using right shift by 1 on c // print the LSB of C (either 0 or 1) // note that here the work of the recursive step is carried out after the recursive step

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution