Selection Sort - Run Time Error

Why my code shows run time error if I initialise minIndex with INT_MAX instead of i ??

Hi @priyanshi.agarwal3405
This is because when you initialise minIndex with INT_MAX then in line :
if(arr[minIndex]>arr[j])
you are trying to access arr[minIndex] which is out of the limit of arr hence giving run time error.

oh!! ok ok. Thank you sir.