array search from a sorted / unsorted array using pointers