Binary Search Algorithms Explained using C++
Pablo E. Cortez
4233

Thank you for this clear explanation!

I have a question regarding line 10 in your binary_search.cpp file.

“ int max = (sizeof(array) / sizeof(*array) — 1); // last index value ”

max is the last index value but you have formulated that in an interesting way. Why did you use “sizeof(array) / sizeof(*array) — 1” ? and what is the difference that the pointer makes when it is added to the sizeof parameter in this argument?

Thanks again. :)