Bit invert function in K&R exercise 2-7
问题 Exercise 2-7 of The C Programming Language : Write a function invert(x,p,n) that returns x with the n bits that begin at position p inverted (i.e., 1 changed to 0 and vice versa), leaving the others unchanged. I understood the question like this: I have 182 which is 101(101)10 in binary, the part in parentheses has to be inverted without changing the rest. The return value should be 10101010 then, which is 170 in decimal. Here is my attempt: #include <stdio.h> unsigned int getbits(unsigned