Question: The left-shift operator can be used to pack two character values into an unsigned integer variable. Write a program that inputs two characters from the

The left-shift operator can be used to pack two character values into an unsigned integer variable. Write a program that inputs two characters from the keyboard and passes them to function packCharacters. To pack two characters into an unsigned integer variable, assign the first character to the unsigned variable, shift the unsigned variable left by 8- bit positions and combine the unsigned variable with the second character using the bitwise inclusive OR operator. The program should output the characters in their bit format before and after they are packed into the unsigned integer to prove that the characters are in fact packed correctly in the unsigned variable.

Write the program in C.

The left-shift operator can be used to pack two character values into

Enter two characters: A B A' in bits as an unsigned integers is: 65-00000000 01000001 an unsigned integers is: 'Bin bits as 66-00000000 01000010 'A' and 'B' packed in an unsigned integer 16706-01000001 01000010

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!