Check out example codes for "how to sort in descending order c++". It will help you in understanding the concepts better.

Code Example 1

int arr[10];
int length = sizeof(arr)/sizeof(arr[0]); 
sort(arr, arr+length, greater<int>());

Learn ReactJs, React Native from akashmittal.com