Using function as a parameter

in the video while using ‘compare’ function as a parameter in bubble_sort function ‘&cmp’ is used. Also in the condition if(cmp(a[j],a[j+1])) is written. Shouldn’t it be ‘compare’ instead of ‘cmp’ ? And why is the program coming out to be error free?

This is the syntax for passing reference to a function to another function
We passed reference of compare function so that sort function can use the custom comparator.

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.