I was trying to sort an array on my own without copying any pre-tought method in my terminal the code gets compiled but I guess it keeps on running in the online compiler it shows segmentation fault.
#include <stdio.h>
int main(){
int arr[]={2,45,23,12,34,6,23,78,9,33}; //minimum of an array
int len=sizeof(arr)/sizeof(int);
//printf("%d\n",len);
int min;
min=arr[0];
int temp;
for(int j=0;j<len;j++){
for(int i=0;i<len;i++){
if(arr[i]<min){
min=arr[i];
temp=i;
}
}
int v;
v=arr[j];
arr[j]=min;
arr[temp]=v;
}
printf("%d\n",min);
for(int k=0;k<len;k++){
printf("sorted array is %d\n",arr[k]);
}
return 0;
}