Unable to understand how vector comparator parameter work

Can anyone please help me understand how comparator fucntion is able to sort the array in descening order, why we have not put () in front of comparator var in 3rd vector parameter?

1 Like

sort() takes a third parameter that is used to specify the order in which elements are to be sorted. We can pass “greater()” function to sort in descending order. This function does a comparison in a way that puts greater element before.

Please contact me at
[email protected]
I need some help regarding learning to code and etc, Please help me also