K&R C Exercise 2-7: invert — Flip n Bits at Position p
K&R C Exercise 2-7 — invert(x, p, n) Exercise 2-7: 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. Approach XOR is the natural bit-flip operator: b ^ 1 = ~b and b ^ 0 …