|
[x]
Posted via EE Mobile
|
|
| Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again. |
|
|
|
|
Asked by jade09091990 in C++ Programming Language, C / C++ / C# Editors and IDEs
i have this strange problem for example i allocate memory for arrays of pointers
char **p;
char **q;
p = new char*[19];
q = new char*[19];
for( int i=0; i<19; i++ )
{
p[ctr] = new char[3];
q[ctr] = new char[3];
for( int j=0; j<3 ;j++ )
{
p[ctr][j] = NULL;
q[ctr][j] = NULL;
}
}
the problem is, when i perform delete of one of array of pointers, say it is p, then the q also deallocates, what is really happening regarding this?
for( int a=0; a<19; a++)
{
delete [] p[a];
}
delete [] p;
20091111-EE-VQP-92 - Hierarchy / EE_QW_3_20080625