Quote Originally Posted by JezW View Post
and how might one go about this?

Jez
That was described in post #7 in this thread.

Note, however, that if you just pass the value, there is no way [1][2] that the code INSIDE the function can modify the value outside of the function - it has no access to the value.

[1] If the parameter is an array, it becomes a pointer, and in this way, it IS possible to modify parameters that are arrays.

[2] Beginners: Please ignore this part. Yes, a function can do anything it like, and it can, given some relatively restricted conditions modify data that was passed in by creating it's own pointer, and move back beyond the stack-frame of the current process. But we are talking the same sort of thing as if I said "you as a driver of a car can not affect other drivers of other cars" and then someone saying "But if my car is bigger/stronger, I can push the other cars around on the road" - of course, that is POSSIBLE, but you are not doing things how they should be done, and you can't do that all the time, since some cars will probably be bigger than yours. I'm just covering the fact that some pedant will point out the flaw in my categorical statement above [as I would do]

--
Mats