To find min and max b/w N numbers

why have we used INT_MAX with min_so_far
and INT_MIN with max_so_far

please can you elaborate the reason

hello @bhavaysinghal this is why we have to do because normally INT_MAX very large number we have in our array and opposite is true for INT_MIN (i.e it is the very small number )
if you want to find the maximum element in the array then if you compare your element with the INT_MAX then do you think that you will be able to find the maximum element in your array .
the answer is no because if you compare your array elements with the already maximum element then your maximum will be INT_MAX only that is the reason we have to compare with the INT_MIN
let us take the exaple of the array as
15 250 3514 -14 27
then in this array if you find the maximum element then you will compare your first element with the variable which is initialised with INT_MIN .
suppose we are on first element and now we will check if first element is greater then the INT_MIN then you will update the current max as present number and then you will compare the
second number if that number is greater then the first number then the maximum will be further updated otherwise not .
this way we will do till the array becomes empty and the maximum element will be
3514.
you have to do with INT_MAX for finding the min element .
if you feel your doubt is cleared please mark this as resolved .
Happy Learning !!