Question: Consider the following 16-bit bit fields structure: 14 13 Gender 11 9 7 0 Hair Color Age (f) (g) (h) Assume that the variable

Consider the following 16-bit bit fields structure: 14 13 Gender 11 9 7 0 Hair Color Age (f) (g) (h) Assume that the variable is declared as an unsigned integer (16 bits), Write code using only shift and bitwise operators to copy the Hair Color to a variable called "hairColor". Implement the structure using packed structure. Show how you can access the hair color using the packed structure. Declare a union named "packed" with the appropriate member elements so that its content can be accessed as single 16-bit integer called "whole" and or array of two 8-bits chars called "Parts".
Step by Step Solution
There are 3 Steps involved in it
f To copy the hair color field from the 16bit unsigned integer variable and store it in another vari... View full answer
Get step-by-step solutions from verified subject matter experts
