I am trying to store an array of characters on the heap.
The following code works
char *array[3];
*array = new char;
And also the following
char *array[3];
array[0] = new char;
But not the following
char *array[3];
array = new char;
I viewed the contents of *array
, array[0]
and array
. The first and second do not contain valid pointer addresses after assigning using new
but the third one does.
So what makes the third one not work? How do the other two work while they just seem to store some unknown symbols (such as $,%,-) rather than the actual address of the pointer?