Re: Dynamic memory/ leaks
well you can use char * pHello = new char[6]; but other then that, as long as you free somewhere your fine.
Memory leaks are only bad if you have a function you call a lot and you don't free any of the memory used by it.
Re: Dynamic memory/ leaks
Quote:
Originally Posted by high6
Memory leaks are only bad if you have a function you call a lot and you don't free any of the memory used by it.
I can't begin to tell you how terrible that theory is..
While it is true things should be fine if you free them "somewhere", you should never pass dynamically allocated memory from a class. Keep to the mindset that, wherever you allocate memory, you should also remove it.
chem