G
gopal
Hi i have the following code
int length = _tcslen(pszSourceString);
m_pstrStartingPos = new TCHAR[length + 1];
memset(m_pstrStartingPos, 0, (length * sizeof(TCHAR)));
when i enter this code in a function first time then
m_pstrStartingPos is NULL
next when i enter the function i just initialize to NULL, but i am not
using DELETE to delete the allocated memory, is this is the corect way?
Using new
then set the variable to NULL
or should delete be used
Regards
JK
int length = _tcslen(pszSourceString);
m_pstrStartingPos = new TCHAR[length + 1];
memset(m_pstrStartingPos, 0, (length * sizeof(TCHAR)));
when i enter this code in a function first time then
m_pstrStartingPos is NULL
next when i enter the function i just initialize to NULL, but i am not
using DELETE to delete the allocated memory, is this is the corect way?
Using new
then set the variable to NULL
or should delete be used
Regards
JK