If i dont write return -1 in end of program ,it is failing in codeblocks whereas in gcc ,it works fine without return at end of my funchtion,whyy?

int mid=(s+e)>>1;

if(arr[mid]==k)return mid;

if(arr[mid]>arr[s] ){
    if(k>=arr[s] && k<=arr[mid])return findinrotated(arr,s,mid-1,k);

    else return findinrotated(arr,(mid+1),e,k);
					 }					
if(arr[mid]<arr[e]){

    if(k>=arr[mid] && k<=arr[e])return 

findinrotated(arr,mid+1,e,k);
else return findinrotated(arr,s,mid-1,k);
}
}
return -1;
}
int main(){
int n;cin>>n;int arr[n];
for(int i=0;i<n;i++)cin>>arr[i];
int k;cin>>k;
cout<<findinrotated(arr,0,n-1,k);
}

Hey @argus please share your entire code using ide.codingblocks.com so that i give you an appropriate answer for it.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.