Well, I am not sure why don't we specify the size in delete operator? I know compiler finds it out after we allocate memory using new, but just want to know how it does it? I mean the internal implementation.
int* p = new int[5];
delete [] p //no size is mentioned.
The size of an array is stored in run-time data. Internaly, when you declare int foo[n]; or int* foo=newint[n];, somewhere the compiler stores data: "array foo has n members". I don't know excatly how, but I know it does. Another example is that you can make a temlate function that has the template parameter thenumber of elements, and real parameter is a reverence to an array, and you can call it implicitly, without delaring the no. of elements, and it will know it! http://www.cplusplus.com/articles/D4SGz8AR/