I am confused about deallocating all memory space that the pointer to pointer points to.

For example, there is a pointer to pointer as follows:

```
int **p;                      //  +-----+      +-----+      +-----+-----+-----+
p  = malloc(sizeof(int*));    //  |  p  |----->|     |----->|     |     |     |
*p = calloc(3, sizeof(int));  //  +-----+      +-----+      +-----+-----+-----+

```

AFAIK, the right way to deallocate all memory space is

```
free(*p);
free(p);   // The order is unchangeable.

```

`void free (void* ptr)` deallocates the memory space that `ptr` points to, but p is a pointer to pointer, so why not use `free((void*)p)` to deallocate memory space instead of using `free(p)`?