Question: Write a C function to set bit7 (bit counts from the right to left as bit0, bit1, bit2, bit3, bit4, bit5, bit6, bit7, ) in
Write a C function to set bit7 (bit counts from the right to left as bit0, bit1, bit2, bit3, bit4, bit5, bit6, bit7, ) in an unsigned integer number, and return the converted unsigned number.
The function prototype is as follows,
unsigned int set_bit7(unsigned int n);
/* set bit7 of n to 1 and keep the remaining bits unchanged, and return the result to the function. */
For example, a function call like set_bit7(127) will return 255, while set_bit7(0) will return 128
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
