Question: Write a function that accepts an array of unsigned char sized integers describing an integer in binary format (each item in the array corresponds to
Write a function that accepts an array of unsigned char sized integers describing an integer in binary format (each item in the array corresponds to a single bit of the integer) and prints each element of the array as a decimal number. The function prototype (or signature) is: void printBitArray (unsigned char theBits (SIZE_INT)); Write a function accepts an unsigned short sized integer value and an array of unsigned char sized integer values. The function places each of the 16 bits of unsigned short integer into different array elements, in the least significant bit location. If, for example, the input integer was 25 ( = 0x0019 = Ob0000000000011001 ) then the array would need to contain: The function prototype (or signature) is: void toBits (unsigned short value, unsigned char inBits (SIZE INT)); NOTE: While this can be completed using the integer modulus and division operators, more grades will be awarded to code that uses at least 1 bitwise operator and a mask and bit shifting. Write a recursive function that accepts an unsigned short sized integer parameter, calculates and returns the factorial of that value. The return value should also be an unsigned short integer. The function prototype (or signature) is: unsigned short factorial (unsigned short num); Write a main function that, inputs an integer number (of size unsigned short), calculates the factorial of that number, uses toBits to place the 16 bits of the result into 16 separate locations of a byte sized integer array, and then uses printBits to output the contents of that array. Finally, the program should give the user the option of re-running with different input
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
