What is error in this code

#include<bits/stdc++.h>
using namespace std;
int selectionsort(int arr[],int n)
{
for(int i=0;i<n-1;i++)
{
int min=i;
for(int j=i+1;j<n;j++)
{
if(arr[j]<arr[min])
{
min=j;

	  }
	  swap(arr[i],arr[min];
  }

}
}
void printarray(int arr[],int n)
{
int i;
for(int i=0;i<n;i++)
{
cout<<arr[i]<<endl;

}

}
int main()
{
int i, n;
cin>>n;
for(int i=0;i<n;i++)
{
cin>>arr[i];
}
selectionsort( arr, n) ;

printarray( arr, n) ;
return 0;

}

@shdanish1508
plz save your code at http://ide.codingblocks.com/ ans then share link here.

@shdanish1508
In the above code, you haven’t called selectionSort() function. Just delete line 28 and write
selectionsort(a,n);
for(int i=0;i<n;i++){ cout<<a[i]<<endl; }
Your code will work

As you got 100 points, I am marking it as resolved.

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.