Inbuilt Sort Doubt

How does the sort function know which array to sort as we have given only two parameters which include the start and end of the container??

As you have given parameters as start and end, it will sort everything from start to end. If parameters were from start to start+4, it would have sorted from beginning till 4 positions ahead of beginning and so on…
For sorting arrays you write sort(arr,arr+n)…so here array arr will be sorted
For vectors you write sort(vec.begin(),vec.end())…so herer vector vec will be sorted.

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.