Code is not running(segmentation error)

#include
using namespace std;

int sel_sort(int a[],int n)
{
int min_index;
for(int i = 0;i<n-1;i++)
{min_index=i;
for(int j=i;i<=n-1;j++)
{if(a[min_index]>a[j])
{min_index=j;
}
}swap(a[i],a[min_index]);

}

}
int main(){
int n;
cout<<“enter the size of the array:”<<endl;
cin>>n;
int a[1000];
for(int i =0;i<n;i++){cin>>a[i];
}
sel_sort(a,n);
cout<<“the array is:”<<endl;
for(int i=0;i<n;i++)
{cout<<a[i]<<endl;
}

}

doesnt execute

please send the link of your code

how to send Link of Code ?
paste you code at

click on file->save->link will be generated
send the link of code generated
it will look like https://ide.codingblocks.com/s/258793

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.