Compare Function arguments in sort function

While passing the compare function as argument in sort function , how does compare function function know which values are to be compared , because we have not passed variables in compare while passing compare as argument in sort.

@Rishabh1705 hi,thats inbuilt sorting hme bs sort function ko btana hota hai ki kis hisab se woh elemnts ko compare krke sort kre ,baki kam sort function ka hota hai ,woh elements ko us hisab se compare krke internal sorting krta hai nlogn me.Hope you get it,don’t go deep inside it’s working.

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.