C++ Unique Pointer Question

Question

Write a program that defines a unique pointer to an integer value.

Use the std::make_ unique function to create a pointer.

You can use the following code structure:

#include <iostream> 

int main() 
{ 
    //your code here
} 


#include <iostream> 
#include <memory> 

int main() 
{ 
    std::unique_ptr<int> p = std::make_unique<int>(123); 
    std::cout << "The value of a pointed-to object is: " << *p << '\n'; 
} 



PreviousNext

Related