Apple interview question

Write a C function to isolate n bits at offset k.