title: K&R C Exercise Help
body: <p>I've been going through the K&amp;R C Programming Language book and I'm stuck on Exercise 2-6 which reads:</p>
  
  <blockquote>
    <p>Write a function setbits(x,p,n,y) that returns x with the n bits that begin at position p set to the rightmost n bits of y, leaving the other bits unchanged. </p>
  </blockquote>
  
  <p>I'm having trouble understanding the exact thing they're looking for me to do.  I looked at a possible answer <a href="http://users.powernet.co.uk/eton/kandr2/krx206.html" rel="noreferrer">here</a>, but I still don't really understand.  I think it's the wording that's throwing me off.  Can anyone maybe explain what they're looking for me to do in a different way?  I'm hoping that different wording will help me understand what I need to do code wise.</p>