Original Post
I have an array:
int *array = new int [5];
array[0] = 5;
array[1] = 2;
array[2] = 8;
array[3] = 6;
array[4] = 7;
Now I assign a pointer as so:
int *pointer = &array[2];
Now I sort the array:
(std::sort or so):
array[0] = 2;
array[1] = 5;
array[2] = 6;
array[3] = 7;
array[4] = 8;
Now my pointer will point to the value 6 but
I want it to continue pointing to the value 8, thus to the value before the sort.
PS: Changing the order is not an option.
-CProgrammer