i am reading some memory leaking problem articles now.
Here is one question i can't understand:
char *a= new char; char *b= new char; b=a;//pointer assignment delete b;
In this article, it mentioned that the pointer assignment have side-effect and we couldn't delete pointer b from heap anymore.
its better use strcpy(b,a) function.
My question is:
is that correct??
if we couldn't delete b from heap what's the
And why the last line of the code free the dynamic variable associated with pointer a??