A good pointer exercise?
I was just going over pointers in C++ and think I have it down now. I''d like to do a small exercise to make sure I know what i''m doing with pointers. What''s a good real world example that deals with pointers, pointers with arrays, and using pointers in functions etc..? I was thinking of making a linked list?
Dynamic data structures like linked lists are excellent examples of situations where pointers are useful. I personally think that every programmer should write a linked list class once in their life ... just be aware that as a C++ programmer, you''re probably better off using std::list. (I still think you should write a linked list class for the learning experience and to gain some understanding of what goes on underneath, but once you have it, use std::list, because it''s probably better than anything any of us here can write ...)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement