The use of sort in c language

sort function in c language

The sort function is a function that can sort an array. The following points need to be noted.

  • To use sort in C++, you need to include the header file, and you need to use the namespace using namespace std;
  • The sort sort is in ascending order.
  • Use format:

sort(a+m,a+n);
Note that m here means to start from the element of the array a subscript m, and n means to stop at the element of the subscript (n-1). (Left closed, right open)

  • According to the above summary, sort can be used to sort elements in the range from any position to any position in the array, but it should be noted that the end is a[n-1], and it should be used not to cross the boundary.

Guess you like

Origin blog.csdn.net/weixin_45688536/article/details/103216980