Last active
August 19, 2020 08:59
-
-
Save junaidrahim/afc777be402960b311ae3df6335a7eb5 to your computer and use it in GitHub Desktop.
Unique Pointer Example 1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
void DoSomething(){ | |
int *p = new int[50]; | |
// do some processing with the array | |
delete[] p; // free the memory | |
} | |
int main(){ | |
DoSomething(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment