Answer
free releases storage previously returned by an allocation function. • Passing a null pointer to free has no effect. • The pointer value becomes indeterminate after the allocated object is freed. • Double-freeing or freeing a pointer not obtained as required by the allocation API has undefined behavior.
💡 C Example
char *buffer = malloc(128);
if (buffer != NULL) {
free(buffer);
buffer = NULL;
}
⚡ Quick Revision
free ends an allocated object’s lifetime; do not use or free it again.