Can you please look into the code and point out what is the error

#include
using namespace std;
int Findindex(int*a,int n,int i,int key){
if (i==n){
return -1;
}
if (a[0]==key){
int bi= Findindex(a,n,i+1,key);
if (bi!= -1){
return bi;
}
return i;}
}
int main() {
int n,key;
int i;
int a[n];
cin>>n;
for(int i=0;i<n;i++){
cin>>a[i];
}
cin>>key;
cout<<Findindex(a,n,i,key)<<endl;
return 0;
}

hi @abhigyankumar09 updated

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.