Question: ( Unpacking Characters from an Integer ) Using the right - shift operator, the bitwise AND operator and a mask, write function unpackCharacters that takes
Unpacking Characters from an Integer Using the rightshift operator, the bitwise AND operator and a mask, write function unpackCharacters that takes the unsigned int from Exercise and unpacks it into four characters. To unpack characters from a fourbyte unsigned int, combine the unsigned int with the mask and right shift the result bits. Assign the resulting value to a char variable. Then combine the unsigned int with the mask Assign the result to another char variable. Continue this process with the masks and The program should print the unsigned int in bits before it's unpacked, then print the characters in bits to confirm that they were unpacked correctly.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
