I allocated memory and i forgot to delete it at the end and then i compiled it.
Then i realized my mistake and deleted it and recompiled the program.
But it keeps giving me the same result as before having not deleted it.
Even if i restart my system it wont compile with the changed code.
Whats the deal with this? Its not the first time that it happens to me.
Isnt memory freed when you close a program even if you didnt freed it in your program?
Code:#include <iostream> using namespace std; int *pPointer; void SomeFunction() { // make pPointer point to a new integer pPointer = new int; *pPointer = 25; } int main() { cout<< "Value of *pPointer before:"<< *pPointer <<endl; SomeFunction(); // make pPointer point to something cout<< "Value of *pPointer after: "<< *pPointer <<endl; delete pPointer; system ("pause"); }