c++ - No matching function for 'sort(int [2000], int)'| while sorting array -


i wanted sort array in simple way error below. how deal that?

**no matching function call 'sort(int [2000], int)'|**

#include <iostream> #include <algorithm>  using namespace std;  int main(){     int v[2000];     std::sort(v, 2000);     cout << "hello world!" << endl;     return 0; } 

the correct statement is:

std::sort(v, v + 2000); 

the function takes 2 iterators, beginning , end of range sort. pointer random-access iterator, can used function expects one. in case, v + 2000 points past end of array , correctly stands end of range.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -