What is the purpose of declaring minsofar=INT_MAX and maxsofar=INT_MIN. and why we had to include header file climits. in the explanation sir took minsofar equal to -infinity and maxsofar equal to +infinity.plz explain
Header file climits
hi… since we have to find maximum and minimum numbers so initially we take 2 variables minsofar=INT_MAX and maxsofar=INT_MIN.
minsofar will contain the smallest no so we just initialize it with largest possible value ie INT_MAX. reverse is the case of maxsofar…
climits is a header file the provides us with INT_MAX (+infinity) and INT_MIN(-infinity)…
hope it clears all ur doubts…
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.