Binary search basic problem doubt

I am unable to understand the editorial. Please elaborate using an example.

https://ide.codingblocks.com/s/65562 my code, according to my understanding.