free(ptr); Even though we are just proving ptr, How it assumes exact size of memory allocated first to be freed? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

free(ptr); Even though we are just proving ptr, How it assumes exact size of memory allocated first to be freed?

How exactly it deletes whole allocated structure ?

12th Oct 2018, 8:37 PM
TheEngineerIN
TheEngineerIN - avatar
1 Answer
0
During malloc, some of the storage grabbed is used internally to maintain system depended information including the size before handing the rest of it back as the function return.
12th Oct 2018, 9:06 PM
John Wells
John Wells - avatar