C - free() - Releasing Dynamically Allocated Memory


To release the memory stored in the pointer pNumber, write this statement:

pNumber = NULL;

The free() function has a formal parameter of type void*.

Because any pointer type can be automatically converted to this type, you can pass a pointer of any type as the argument.

If you pass a NULL pointer to the free() function, the function does nothing.

Related Topics