Comparators concept

are we calling function ‘bool compare’ through ‘bool &cmp’ and if yes then why are we writhing cmp(a,b) within bubble sort instead of ‘&cmp’.
please explain (video time 3:10)

Hello @aditi2512201012019,

You have understood the concept incorrectly.
Related this with pass by reference method.

When you have to pass a variable as reference to a function:
void fun1(int &b){
//accessing the referenced valriable:
int c=b+1;
}
//call
fun1(a);

The same has been done for a function:
void fun1(int &cmp(int a, int b)){
//accessing the referenced function:
cmp(1,2);
}
//call
fun1(compare);

Hope, this would help.
Give a like if you are satisfied.