It's almost common knowledge that the code below correctly frees the memory of 100 integers.
int* ip = new int[100];
delete [] ip;
And I think even for user defined classes it works:
Node* ip = new Node[100];
delete [] ip;
In the first case, is the size of memory to be freed (400 bytes), determined at compile time? Basically, what goes on internally?
In the second case, will the destructor of
Nodebe called on each of the 100 objects?
Essentially, I have been using this syntax, but never understood what goes on internally and now I am curious.
std::vector<>, though, in normal use.