Tuesday, 15 May 2012

C strings deletion in C++ -



C strings deletion in C++ -

what's , what's wrong? in case have phone call delete in order prevent memory leak? also, behaviour same in c , c++? there differences?

const char* = "blahblah"; ... delete a; char b* = new char('a'); ... delete b; char c[100] = "blahblah"; ... delete c; char d* = new char[40]; ... delete d; char e* = new char[40]; ... delete[] e;

in case have phone call delete in order prevent memory leak

only delete got new , delete [] got new []. every other delete wrong.

c++ c string

No comments:

Post a Comment