Quantcast
Channel: Pointer or array? - Stack Overflow
Browsing all 3 articles
Browse latest View live

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 Article



Answer 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 Article

Pointer 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
Browsing all 3 articles
Browse latest View live




Latest Images