please explain me the use of return -1
What is the use of return -1 in cpp
@sonu28sharma99,
It is just a indicator that the requires element wasn’t found in the array, because if found the search would have returned an index in the range [0,n), so if we find a ‘-1’ we can say for sure, that the element is no present in the array.