I am new to C programming and not sure that there is already a good explanation for how to do this, if so I am sorry. I am trying to set the bits within a range given to me.
If its inclusive
mask = ~(~0 << (end - start + 1)); value = (n >> start) & mask;
where n is the original integer, and value is the extracted bits.