Sending function as a parameter to another function?

I am having doubt in this , i havent understood its working .

@LPU11910344 how passing of function as parameter works or how comparator passed(function) passed in sort function works?
In case of comparators, comparators are boolean functions that compare two elements of the container.
container should return true, when the first parameter of the comparator need to be placed ahead of second. Eg

bool comp(int a, int b)
{
     return a>b;
}

this will cause the array to be sorted in descending order, as when a is greater than b it returns true, a is put before b.
If this resolves your doubt mark it as resolved.

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.