Reputation: 3072
How do I delete this allocated pointer?
int (*foo)[4] = new int[100][4];
Is it just :
delete[] foo;
Upvotes: 1
Views: 129
Reputation: 310930
As you have allocated an array you have to use operator delete[]
delete []foo;
That it would be more clear you can rewrite the code snippet the following way
typedef int T[4];
T *foo = new T[100];
delete []foo;
Upvotes: 5