One word answer is magic and the more detail answer is it stores the amount allocated when allocating. It depends on the compiler used and as far as I remember MS VC stores before the memory chunk. Dont quote me on this as I dont have the VC installed on this PC.