What is the problem with my code?

#include

using namespace std;

int ls1(int a[], int n, int key){

if(n==0){

    return -1;

}

if(a[0]==key){

    return 0;

}

int i=ls1(a+1,n-1,key);

if(i==0){

    return i+1;

}

else 

    return -1;

}

int ls2(int a[], int n, int key, int i){

if(i==n)

    return -1;

if(a[i]==key)

    return i;

else

    return ls2(a,n,key,i+1);

}

int main(){

int a[]={9,8,4,56,3,8,2};

int key=3;

int n=sizeof(a)/sizeof(a[0]);

cout<<ls1(a,n,key)<<endl;

cout<<ls2(a,n,key,0);

}