How the system got to understand &cmp

why &cmp are we using this … why not &compare how willthe system relate both of them if there are multiple functions present

@suryansh771 you always pass the address of your compare function so the system will know exactly which compare function to use.
for eg

bool cmp(int val1, int val2) {
   return val1 > val2;
}

sort(arr, arr+n, cmp); //here you pass the address of the comparator function you wish to use

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.