Run time error ..Y?
you have done one small mistake
i have correct it
no i have done at line 13.
since we need to swap the current element with min index value.
so swap(arr[i],arr[index])
here ith element is current one and index pointing to min element.
Please check once