title: How to print an array in descending order?
body: <p>Basically this is my code and it works fine. I just don't know how to print it in descending order. This code basically shows the odd numbers:1,3,5,7. I want it to be printed 7,5,3,1. I know I need use the sort function but I dont know how. </p>
  
  <pre><code>#include &lt;iostream&gt;
  
  using namespace std;
  
  void fillArray(int arr[], int &amp;n);
  void printArray(int arr[], int n);
  void findSum(int arr[], int &amp;n);
  
  int main()
  {
      int n;
      cin&gt;&gt;n;
      int arr[n];
      fillArray(arr,n);
      printArray(arr,n);
      findSum(arr,n);
  
      return 0;
  }
  
  void fillArray(int arr[], int &amp;n)
  {
      int j=1;
      for(int i=0;i&lt;n;i++)
      {
          if(j%2==1)
              arr[i]=j;
          else
              i--;
          j++;
      }
  }
  
  void printArray(int arr[], int n)
  {
      for(int i=0;i&lt;n;i++)
      {
          cout&lt;&lt;arr[i]&lt;&lt;", ";
      }
  }
  
  void findSum(int arr[], int &amp;n)
  {
      int sum=0;
      for(int i=0;i&lt;n;i++)
      {
          sum=sum+arr[i];
      }
  }
  </code></pre>