why are we passing address of cmp (&cmp) in function defination?Also explain how to know return a>b or return b>a for sorting in descending order
Function as argument,return statement of compare()
@KetanPandey we cannot pass function as a parameter of another function but we can pass function reference to another function.
to sort in descending order the first parameter of your comparator function should be greater than your second parameter means a>b.
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.