?
What will be the output of the given C++ code?
What will be the output of the given C++ code?
#include <bits/stdc++.h>
using namespace std;
int main()
{
int arr[] = {1, 3,4,2,5};
int n = sizeof(arr)/sizeof(arr[0]);
sort(arr+2, arr+n, greater<int>());
int a;
for (int a = 0; a < n; a++)
cout << arr[a] << " ";
return 0;
}
#include <bits/stdc++.h>
using namespace std;
int main()
{
int arr[] = {1, 3,4,2,5};
int n = sizeof(arr)/sizeof(arr[0]);
sort(arr+2, arr+n, greater<int>());
int a;
for (int a = 0; a < n; a++)
cout << arr[a] << " ";
return 0;
}
Join the Discussion
Login to post a comment or share your explanation.
Login