Cpp release memory used by pointer | C plus plus delete dynamic array


script.cpp

#include<iostream>
using namespace std;
int main(){
    int *p = new int[10];
    cout << p << endl;
    delete p;
    p = NULL;
    cout << p << endl;
    return 0;
}

Download code here

Comments

Popular posts from this blog