Can Someone Explain me this part? What would a[0] do if the key is found? if i get 0, how would it get added to the final index?

if( i == -1){

   if(a [0] == key){
		return 0;
	}else{
		return -1;
	}
}

hello @JaveedYara

pls share the complete code.
i m not getting anything from this small snippet

https://codeshare.io/5zBM6E

image
see line number 15. that is responsible for getting the final answer.

for example->
1 2 3

let say u r looking for 2.
first u will make call on 1 , it will make call on 2 because 2 is required key we will return 0 to 1 .
at 1 we will add one to it and it will finally return 1,
so 1 is the required index we get