Problem related to & symbol

During defining of function
void bubble_sort(int a[ ],int n,bool(&cmp)(int a, int b)
why we are giving & symbol

hello @vikash3303
we are passing cmp function as reference thats why we are using & symbol before function name.

read more

https://ide.codingblocks.com/s/334944 why desired output is not coming

image
here it should be j<n-1

why we have used j<n-1;why can’t we use j<n;

for this case j+1 will be invalid when j=n-1 thats why