The reason is because your pointer variable is no longer pointing at the memory location you initialized using new.
In your for loop you are incremementing the location pointed to by the numbers variable. At the end of the loop numbers is pointing at a different location than where it started.
For this particular example to work I would add the following line of code at right after the for loop.
numbers -= max_value;
|