how using bool function in sort function is sorting our array according to our needs
basically doubt is
what bool function is returning
how that return value is helping in sorting
Use of bool function in sorting
@soorya19k basically that bool function is known as comparator function , through this function we can sort array in particular order.Comparator functiom takes two arguments or elements and then compare these two elements according to criteria you mention in function and when we apply sort function ,comparator function do its work and compare every two elements of array or whole array and inbuilt sorting takes place in nlogn complexity.Generally bool value is returned by comparator function which returns true when comparison criteria is correct between two elements of array and in this way whole array is sorted internally.
Hope you get your doubt.Feel free to ask any doubt