you're passing value by value...that sounds wierd, let me explain. There are different ways of passing an argument into a function, you can pass by value, like you have with your 'value' variable, you can pass by pointer, like you have with the pointer to your array, or you can pass by reference. Passing 'value' by reference would solve your problem here, read this to find out why
EDIT - Also, you shouldn't be checking that pos >= 1 && pos <= numElements in your function, arrays start at zero, an array of size 5 has elements 0-4. Check that pos >= 0 && pos < numElements. Trying to read array[numElements] will give you problems as the final element is of course array[numElements - 1]