Pointers: When to use them and when to not?
I''m in the middle of the chapter about pointers in Sams Teach Yourself C++ in 21 days. And, well my question is pretty much what''s in the topic. Pointers seems to be very much like variables only that the memory are taken from another part. So when should I use them and when should I not?
I just finished my first game, a brick clone made in the Windows Consol. To do it I didn''t use any pointers and it seems to run just fine. Should I have used pointers?
Yes, you''ll use pointers a lot, but that doesn''t mean you''ll always use them (well, I seem to almost always use them in my programs...). They''re useful for resource sharing (having a pointer to an object rather than 400 copies of it for each thing that needs to use it), dynamic memory allocation, passing large parameters or objects that you want modified by the function you pass them to, et cetera.
[Resist Windows XP''s Invasive Production Activation Technology!]
[Resist Windows XP''s Invasive Production Activation Technology!]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement