This simple code snippet shows how interpolating can be done in C using signed integers.
The for() loop determinest the range to interpolate from. In this case -100 to +100. For loop is here just to work as an example.
12th line is were the work is done. 256.0 is the top end of the range while 201.0 is the number of values in the list to be interpolated (-100 to +100). 127 is added because we want to interpolate to values between 0 and 255, not -127 to +127. The other two lines are just for rounding.
The trick here is to use floating point values instead of whole numbers, otherwise interpolation won't work properly.