adplus-dvertising
frame-decoration

Question

What is the output of this program?
    #include <iostream>
    #include <memory>
    #include <string>
    using namespace std;
    int main () 
    {
        pair <string*, ptrdiff_t>
       result = get_temporary_buffer<string>(3);
        if (result.second > 0)
        {
            uninitialized_fill ( result.first, result.first + result.second, 
            "Hai" );
            for (int i=0; i<result.second; i++)
                cout << result.first[i] ;
            return_temporary_buffer(result.first);
        }
        return 0;
    }

a.

Hai

b.

HaiHai

c.

HaiHaiHai

d.

None of the mentioned

Answer: (c).HaiHaiHai

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the output of this program?