I am passing a pointer a function that updates it. However when the function returns the pointer it returns to the value it had prior to the function call.
Here is m
When you give a pointer to a function, you have a copy of the reference value that you originally had.
Then, if you modify your pointer, you're modifying a copy.
If you want to update the original one, you need to pass it with a double pointer **
which will let you modify the original pointer, passing a "reference to a reference" (double pointer).