+ 1
difference between delete and overwrite for pointers in C++
Hi, As I learn about pointers, dynamic memory allocation etc. I wonder : Solo learn suggest that a dangling pointer can be re-allocated. since the pointers point toward unnamed variable, what use is there to delete the pointer, then re-allocate it a new variable of the same type on which you will store data. Wouldn't it have exactly the same effect just to overwrite the new data on the old one ?
3 odpowiedzi
+ 1
In the chapter "dynamic memory" of the introduction... What... I ask to many questions at this stage ? ^^
+ 1
Hmmm thx Bennett, I didn't get everything so far (didn't reach the chapter on lists or objects yet) but I feel that it will soon make sense thx to your explanations and said chapter :)
+ 1
Yes, that is what I got from your answer, and since I don't know or understand those scenarii yet, I just need to move forward in the lessons :)