How does free(x) know when to stop?
I'm not sure if my question even makes sense, cause I don't know how free works (I've just learned that it needs to be used after we're done with anything that we malloc'ed).
If you malloc(some number of bytes), will the system put some kind of marker at the end of the box of memory it reserved, so free() knows how much memory was associated?
Also, if you have a block of memory, and a pointer (call it ptr) to somewhere in the middle of that block, what happens if you free(ptr)?
 silly typo, irrelevant though