Please help me understand this:
I have a pointer to a pointer
char** word_array = NULL;
Then I dynamically allocate memory in my code:
n = 6; word_array = (char *) malloc(n* sizeof(char*));
How do I delete all the memory allocated for the "array" of pointers? Is this call to
free
right?free(word_array);
Or should I make a loop:
for(int i = 0 ; i < n; i++) free(word_array + i);