Thanks a lot.
How does it keep track that this pointer will run to these many elements in memory?
For example assume I have a function like below
int* supplyPtr()
{
int* pSet = new int[10];
return ++pSet;
}
void main()
{
int* p = supplyPtr();
delete[] p;
}
In the above sample how does it keep track of p?
when I return pSet from the supplyPtr, it cleanly deletes the memory.
But if I pass ++pSet, it asserts. How does it associate a pointer and it's number of elements in memory? Could you please explain? or point me to the right resource?