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!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
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 Antwort
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