C++ Memory Management: What is the difference between 'delete' and 'delete'?
Q: What is the difference between 'delete' and 'delete'?
A: Whenever you allocate memory with 'new', you have to free the memory using 'delete'. When you allocate memory with 'new', then use 'delete' without the brackets. You use 'new' to allocate an array of values (always starting at the index 0).
int *pi = new int; // allocates a single integer
int *pi_array = new int; // allocates an array of 10 integers
pi = 0;
delete  pi_array;
pi_array = 0;