c++ remove variable from memory code example
Example 1: c++ delet from memory
// Delete pointer
int* ptr1 = new int;
delete ptr1;
// Delete array
int* array = new int[10];
delete[] array;
Example 2: how to delete variable in c++
string* x = new string();
//...
delete x;