Sorting an array

Suman Barik
0
#include <bits/stdc++.h>

using namespace std;

void func(int a[4], int n) {

  for(int i = 0; i < n; ++i) {
  
    cout << a[i] << " ";
    
  }
  
}

int main() {

  int a[4] = { 23, 34, 75, 39 };
  
  int asize = sizeof(a) / sizeof(a[0]);
  
  cout << "The array before sorting is : \n";
  
  func(a, asize);
  
  cout << "\n\nThe array after sorting is :\n";
   
  sort(a, a + asize);
  
  func(a, asize);
  
  return 0;
  
}

Tags

Post a Comment

0Comments
Post a Comment (0)