Is necessary deallocate memory of pointer-to-pointer?
Example:
my_type_t **example;
example = (my_type_t **) calloc(10, sizeof(my_type_t *));
for (i = 0; i < 10; i++)
{
example[i] = (my_type_t *) malloc(sizeof(my_type_t));
}
// ...
free(example); // it enough?
// Or is necessary do this...
for (i = 0; i < 10; i++)
{
free(example[i]);
}
One more question...
What's the vantage of set NULL to a pointer freed?
Thank you.