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

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -