Question: Write a C program that reads two hexadecimal values from the keyboard and then stores the two values into two variables of type unsigned char.
Write a C program that reads two hexadecimal values from the keyboard and then stores the two values into two variables of type unsigned char. Read two int values p and k from the keyboard, where the values are less than 8. Replace the n bits of the first variable starting at position p with the last n bits of the second variable. The rest of the bits of the first variable remain unchanged. Display the resulting value of the first variable using printf %x.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
