c++ - Use `delete []` when `new [0]` -


this question has answer here:

i dynamically allocated array (unsigned int n might have been passed parameter in function):

int * ar = new int [n]; 

when i'm done using it:

delete [] ar; 

but, happens when n = 0? allocate 0 ints same not allocating @ all? in case, bad things happen when call delete?

it's ok new zero-sized array, , delete it. more of convenience anything, means don't have write separate conditions 0 case.


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -