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

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!