In your search function, you are mixing up values and min/max.
in the beginning min should be 0 and max should be n-1 (not the values of these elements)
then in the while loop you need value z isn't needed, but you need to set
int mid = (min+max)/2
then compare value to values[mid] for your three cases.
Otherwise you will never leave your while loop, because you keep the values of the array to mid and then incrementing and decrementing this, but you aren't moving through the array.
Just as a side note, your code
int* pointerto1= &values[i];
int* pointerto2= &values[i+1];
isn't really needed.
you can just use