Original Post
Hi there! When I was coding some things, a question came up.
How does C++ remember the size of an array located on the heap?
Like this:
int* pInts = new int[100];
Then I want to delete them with
delete [] pInts;
Okay, in this example, the compiler might easily "remember" how many ints to delete since "100" is a constant, but what if it''s a variable like:
int sz = 100;
int* pInts = new int[sz];
delete [] pInts;
Does the compiler generate a size variable somewhere to remember how many ints I''ve allocated or what?
----------------------------------------------
Petter Nordlander
"There are only 10 kinds of people in the world. The who understand binary and those who don''t"