Call sort func of this code of vector

Why you call sort function like these :
Sort(v.begin(),v.end(),compare) and not like these Sort(v.begin(),v.end(),compare())
Because compare is also a function here ?

Hello @yogesh22021998

we call the sort function like this Sort(v.begin(),v.end(),compare) because we are here passing the address of the function to the sort function and NOT calling the function.
If we had called the sort function like this Sort(v.begin(),v.end(),compare()) then the third parameter would be the value returned by the function compare and NOT the function itself.

Let me know if you still need any help.

@yogesh22021998 do you have any query?

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.