-
What is the output of this program?
#include <iostream>
#include <memory>
#include <algorithm>
using namespace std;
int main ()
{
int num[] = {11, 15, 14, 15, 14, 11};
pair <int*, ptrdiff_t> Res = get_temporary_buffer<int>(6);
if (Res.second > 0)
{
uninitialized_copy (num, num + Res.second, Res.first);
sort (Res.first, Res.first + Res.second);
for (int k = 0; k < Res.second; k++)
cout << Res.first[k] << " ";
return_temporary_buffer (Res.first);
}
return 0;
}
-
- 11 11
- 11 11 14
- 11 11 14 14 15 15
- 14 15 15
- 14 15
Correct Option: C
In this program, We are sorting the array by using the allocator.