Birany search code not working

#include
using namespace std;
int binary(int arr[], int key, int start, int last)
{
if(start==last) return -1;
int mid= (last-start)/2;
if(key==arr[mid]) return mid;
else if(key<arr[mid])
return binary(arr, key, start, mid-1);
else if(key>arr[mid])
return binary(arr, key, mid+1, last);

}
int main()
{
int n;
cin>>n;
int arr[n];
int c=0;
while(n–)
{
cin>>arr[c];
c++;
}
int key;
cin>>key;
cout<< binary(arr,key,0,n-1);
}
//This is the code