fork download
  1. #include <iostream>
  2. #include <memory>
  3. using namespace std;
  4.  
  5. void f(){
  6. unique_ptr<int[]> p(new int[5]{1,2,3,4,5});
  7. cout<<p[0]<<endl;
  8. p.reset();
  9. if(p.get()==nullptr) cout<<"NULL"<<endl;
  10. }
  11.  
  12. int main() {
  13. // your code goes here
  14. cout<<"begin call f()"<<endl;
  15. f();
  16. return 0;
  17. }
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
begin call f()
1
NULL