Thanks for notice my question.
In C Primer Plus, it first writes
The argument toshould be a pointer to a block of memory allocated by
free(); you can’t use
malloc()to free memory allocated by other means
It’s okay to use a different pointer variable withthan with
free(); what must agree are the addresses stored in the pointers.
void* p = malloc (100); void* q = p; free (q);
is fine. The argument for free () is the value that was returned by malloc. The sentence "It’s okay to use a different pointer variable with free() than with malloc()" is actually pointless and just creates confusion - of course it is fine to use different variables as long as the value is the same.