Home » C++ Programming » Dynamic Memory » Question
  1. What is the output of this program?
    #include <iostream>
    #include <memory>
    #include <string>
    using namespace std;
    int main ()
    {
    string str[] = {"Interveiw", "Mania"};
    pair <string*, ptrdiff_t> Res = get_temporary_buffer<string>(2);
    if (Res.second>0)
    {
    uninitialized_copy ( str, str + Res.second, Res.first );
    for (int k = 0; k < Res.second; k++)
    cout << Res.first[k] << " ";
    return_temporary_buffer(Res.first);
    }
    return 0;
    }
    1. Compilation Error
    2. Interveiw
    3. Mania
    4. Interveiw Mania
    5. None of these
Correct Option: D

In this program, We are storing the string and retrieving the string by using get_temporary_method.



Your comments will be displayed only after manual approval.