KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
So in most implementations malloc stores an header before the allocated memory to keep track of the allocated memory size (so that it can do free and recalloc). What are the header contents? I wrote a naive code to find it but it doesn't make any sense int * ptr; ptr = malloc(12*sizeof(int)); printf("Header = %d\n",*(ptr-1)); It returns Header = 57 What is happening here?
Tags (comma-separated)
Save Edits
Cancel