The reason why the loop gets stuck is this x+width should be x+=width
However, I don't recommend using floating-point values to control a for loop. Because of possible rounding errors, unexpected behaviour may occur. So I'd recommend using an integer, counting from 1 to n as preferable.
Line 24 isn't needed at that point (it belongs inside the loop, step 5.1).
I don't see where you do height * width inside the loop (step 5.2)?
@ jdowning The rest of the code was listed on previous pages in this thread. But the main thing is the signature of the function pointer (return type and parameters) must match the actual function. In other respects there's nothing special to be done, other than declare the functions in the normal way.
@ bruntmjust
If you like, please post the full code you have so far. I hope it's working at least reasonably well so far.
@ Chervil
Thank you for all of your help! I am glad to say I got the code working pretty well! I am playing with the equations to make it better but it makes a lot more sense to me now what I am doing. I just wanted to thank you for the explanations and the examples.