my code is working without writing bool (&cmp)(int a,int b) in parameter bubble_sort and compare in function call. Why is it so?
My code is working without writing bool (&cmp)(int a,int b) . Why
It is because there is no error in this approach. The function is declared globally, so it works as any normal function. The purpose of the video was just to show how we can pass the functions as parameter because we do so while using inbuilt sort function at times, but when we are using our own sort function there is actually no need of doing that.