Unable to understand compilation error

I think that I have solved the given problem correctly as my code is running perfectly fine on other code editors. However, when I run my code in this code editor I am facing the following compilation error :

source.cpp: In function ‘int LinearSearch(int*, int)’:
source.cpp:16:1: warning: control reaches end of non-void function [-Wreturn-type]
16 | }
| ^

Kindly check my submitted code and inform me about any error that I might have made. Thank you.

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.

Kindly clarify why you did not use a “break” statement in the if-condition “if (a[i]==M)” and also did not use “if(a[i]==N)” condition for the “return -1” statement.

The return statement already exits the loop on finding M , so break is unnecessary, and a[i]==N is irrelevant.

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.

Sorry, I didn’t mean to say if(a[i]==N), I rather meant if(i==n).

if return exits the loop on finding M , break is redundant, and if(i==n) is irrelevant.

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.