No output is displaying

#include
using namespace std;

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

}
int main()
{
int n;
cout<<"enter the size of array: ";
cin>>n;
int arr[n];
cout<<"enter the elemnts of array: ";
for(int i=0;i<n;i++)
{
cin>>arr[i];
}
selection_sort(arr,n);
cout<<printarray(arr,n);

}

only the second largest element of the array is printing how can we print the whole sorted array.

hi @discobot send the code in ide.codingblocks.com
write save and send the url of page

Hi! To find out what I can do, say @discobot display help.