Doubt in Selection Sort

I want to ask why this is not working?

#include
using namespace std;
int main() {
int N,i,j;
cin>>N;
int a[N];
for(i=0;i<N;i++)
{
cin>>a[i];
}
int temp;
for(i=0;i<N-1;i++)
{
int min=a[i];
for(j=i+1;j<N;j++)
{
if(min>a[j])
{
min=a[j];
}
}
temp=min;
min=a[i];
a[i]=temp;
}
for(i=0;i<N;i++)
{
cout<<a[i]<<endl;
}
return 0;
}

Because min is element not index
So when you write min = a[i] then no element in array updates
Only variable min updates

I hope you understand
If not then feel free to ask again

Oh yes minor mistake,thanks for clearing.

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.