Answer by brokenfoot for Pointer or array?
Local variable -> allocated on stack -> gets destroyed automatically when function exits.Dynamically allocated variables -> allocated on heap -> need to delete them after use.If you have a...
View ArticleAnswer by NG. for Pointer or array?
As a rule, you should free or delete anything you malloc or new.With the vector, when you push into a vector, it does a copy. So a copy of a pointer just copies the address that the pointer points to,...
View ArticlePointer or array?
I know that pointers are a lot like arrays (if not one and the same) in a way, but I'm having trouble deciphering when I should explicitly delete a pointer.Take this code for example:#include...
View Article
More Pages to Explore .....