When we are passing “compare” function as a parameter, from where does it gets the value of “a” & “b” to compare, as we have not passed any value to it??
Comparator Function
hello @Shivam01 in compare function it takes parameters from the array or which ever data strucuture you are implemeting sort on .
like if we take the example in which you have array of elements in that you will do sorting like sort(a,a+n,compare) then first it willl take first two parameters from the array and so on and then it will compare .
I hope i have cleared your doubt .
Happy Learning !!