[Cpp] When you are working on a single-chip microcomputer project, you need to encapsulate the free function of the C library, such as MMFree, so that you can add debugging information in it for output. But, alas, I think it's easy. I designed this: [cpp] void MXFreeP (void * p) {free (p); p = NULL;} int main (int argc, char ** argv) {char * p = NULL; p = (char *) malloc (1); if (NULL! = P) {* p = 0x05;} MXFreeP (p); if (NULL = p) {printf ("p = NULL \ n ");} else {printf ("p! = NULL \ n "); // after running, output this} system (" pause "); return 0 ;}result, the system crashed. After I came back, I wrote this on the PC. Although the program did not crash, the content pointed to by the pointer was not released. I think of the previous issue of using pointers as function parameters. Two-dimensional pointers are required. After modification: [cpp] void MXFreePP (void ** p) {free (* p); * p = NULL;} int main (int argc, char ** argv) {char * p = NULL; p = (char *) malloc (1); if (NULL! = P) {* p = 0x05;} MXFreePP (void **) & p); if (NULL = p) {printf ("p = NULL \ n"); // output this} else {printf ("p! = NULL \ n ");} system (" pause "); return 0;} finally got the expected result. However, to use this function, you must obtain a two-dimensional pointer. If it is obtained inside the function, and because it is a value copy, the obtained two-dimensional pointer is not the original two-dimensional pointer. I have been thinking for a long time. Use a macro. [Cpp] # define MXFreePP (p) free (void * (p); \ printf ("I have been freed. \ n ") the pointer to the C language is really profound, and I will continue to study