Finding new memory address?

(I tested the address because I was getting errors and I found out the address changed before it was deleted, by the time the delete is called the titlePTR has already changed its address and it is giving me an error saying "BLOCK TYPE IS VALID" I heard this is when you try to delete a pointer that wasn't made by new (So that made me think about the address)

Btw I know I don't have to make a dynamic array but I am reading a book and it is saying to practice saving memory for times where your program doesn't need to run the code. I posted on a few other places and people always nag about "Don't use new blah blah blah"

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
if (test == "MapleStory")
{

wchar_t *titlePTR = new wchar_t[30]; <-- Example Address: 051
cout << titlePTR;
wchar_t *bodyPTR = new wchar_t[20];
titlePTR = L"MapleStory";
bodyPTR = L"Launching MapleStory...";
MessageBox(NULL, bodyPTR, titlePTR, MB_OK | MB_ICONINFORMATION);
ShellExecute(NULL, L"open", L"GameLauncher.exe", NULL, L"C:\\Nexon\\MapleStory", 1);
cout << endl << titlePTR; <-- Example Address: 0601 
delete[] titlePTR;
delete[] bodyPTR;

}
Topic archived. No new replies allowed.