The difference between “delete” and “delete []” is the former is used for a pointer only while the latter is used for pointers to an array. Take for example the code below:

int main( int argc, char* argv[] ) {
 //declare a pointer to an array of char named as a
 char *a = new char[64];
 //declare a pointer to a char named as b
 char *b = new char;
 
 //since a is a pointer to an array of char the use of delete[] is a must
 delete [] a;
 //for b which is only a pointer to a char use delete
 delete b;
 
 return 0;
}

if you use “delete” on a pointer to an array it will cause a memory leak, so make sure you use the correct “delete”.