About free()

"I am currently a Software Engineering student at ALX. I'm passionate about technology and enjoy conducting research to find answers on my own. I have a natural inclination to ask 'WHY' more often than 'HOW'.
"While working on projects at ALX, I have acquired a wealth of interesting and diverse knowledge about software engineering and computer science in general. Therefore, I needed a place to store and save all this information, allowing me to refer back to it whenever I forget."
You should not try to free the same pointer again, or free a pointer that was not assigned with a valid memory address.
Also it is safe to call free() on a NULL pointer. free() handles NULL pointers gracefully, and calling free(NULL) does nothing. This means that if a pointer has already been freed, it can be set to NULL to avoid double-freeing, and subsequent calls to free() on the NULL pointer will have no effect.
you should not use free() on a memory block that wasn't created with malloc() (or related functions like calloc() and realloc()). Doing so can result in undefined behavior, as the memory manager may not be able to properly manage the memory block.
Something i found in someone's code:
return (free(ptr), NULL);
The expression return (free(ptr), NULL) is using the comma operator. The comma operator evaluates both of its operands and returns the value of the second operand.
In this case, it is equivalent to the following code:
free(ptr); return NULL;



