I have a pointer array defined as some_struct * t_ptr[1000]
which points to a structure some_struct
.And some points of the point array are evaluated.e.g
some_struct * wpaper1 = new some_struct(); //memory leaks detected in this line
wpaper1->tAnswer = useransw;
wpaper1->tKey = key;
t_ptr[100] = wpaper1;
//there're wpaper2,wpaper3....
...
delete[] t_ptr; //release the pointers
The debug message says there're memory leaks detected in the first line code.So how can I release the memory of some_struct
pointed by the t_ptr
array?Do I have to use a loop to detect whether a element is evaluated and then delete it?And I'm using VS2008 on Windows.Thanks.