Question: In C with code please 5) [1 point] Write a function setbit_p(x,p) that sets the p-th bit (at bit position p) of x to 1.
In C with code please
5) [1 point] Write a function setbit_p(x,p) that sets the p-th bit (at bit position p) of x to 1. For example, setbit_p(48,3) will return (56)10 which is (0011 1000)2 6) [2 points] Write a function set_nbits(x,n) that sets n rightmost bits of x to 1. For example, set_nbits(48,3) will return (56) 10 which is (55)10 or (0011 0111)2 7) [1 point] Write a function clearbit(x) that sets the rightmost bit of x to 0. Setting bit to O is also called clearing a bit of x. For example clearbit(55) will return (54)10 which is (0011 0111)2 8) [1 point] Write a function clearbit_p(x,p) that sets the p-th bit (at bit position p) of x to 0. 9) [2 points] Write a function clear_nbits(x,n) that sets n rightmost bits of x to 0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
