Hi,
Quick Question:
Is there any diffence between A and B.
I always thought delete[] was used only if you did new MyType[N];
Thanks,
Rich.
Quick Question:
Is there any diffence between A and B.
I always thought delete[] was used only if you did new MyType[N];
Code:
struct MyType {
int age;
float weight;
];
MyType* pList[10];
int i;
// new each item in the array
for (i = 0; i < 10; i++)
pList[i] = new MyType;
// A. delete the array
for (i = 0; i < 10; i++)
delete pList[i];
// or B. delete the array using delete[]
delete[] pList;
Thanks,
Rich.