Deallocating a character pointer array
I'm a noob to C++ so please excuse my ignorance.
I declared a character pointer array as follows and initialized it.
I tinker around with it for a while, then I try to deallocate its memory.
for(i=0; i<30; i++)
c[i] = new char;
Somehow, this would cause an assertion failure (I'm using VC++ 2003).
So I tried the following
There was no error with this one, but it only ended up deallocating the first element of the array, and none of the other 29 elements were affected.
Is there another way to free up memory for character arrays (or do I have to iterate through each element and delete it)?
One final question. I initialized each char pointer to have 20 characters. But when I check on it in runtime, it would always have 80 characters (with one or two exceptions).
I tried switching the numbers to 5, 10, 30, whatever, and the length of the character array is always 80. Is there any way I can determine this behavior?