Name of the compare function in bubble sort

When we passed the compare function in the bubble sort function, we wrote bool &(cmp) ( int a, int b).

I didn’t understand that what is &cmp. I think it is the way of calling the compare function although i have the doubt that it why is it being called &cmp and not being called like &compare.

hello @vector.9974
first u need to understand that when we call any function by passing variable then the variable name in function call and function definition need not to be same right?

for example->

void sum(int a,int b ) {
something
}
int x=2,y=3;
sum(x,y);  // note here variable name is x and y , but in function definition the variable name is a ,b

same holds true when we pass any function to other function there also we can change the name of function just like we changed x,y variable to a,b

understood that sir… thank you… also i have 2 other doubts in the same concept…

  1. what is the difference between calling a function within another function and passing a function inside another function as a parameter
  1. what is the siginificance of using & while passing the function as the parameter

variable is passed as reference if we use & , oterwise they are passed by value

let say f and g are some function .
then ->

example of calling a function inside another function
f(){
    g()
}

example of passing a function inside another function
  f( g )   // f is function and we are passing function g to it 

by the second question i meant that what is the difference in the working of the program when we call a function within another function and when we pass a function as an argument inside another function

@vector.9974
have u studied functions?

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.