- Nov 6, 2004
- 324
- 0
- 0
I want to get more familiar working with pointers so I'm working on implementing a linked list in C++, for my own enrichment NOT any type of homework.
Anyway, as I do this I am finding for several functions I am needing a temporary pointer to a Node. Is it poor form to repeatedly declare these temporary pointers as the functions require them (seems very repetitious), or better to just go ahead and declare a sort of all purpose pointer as a private variable for my Linked List class? My concern over the latter is having a pointer to an address when it really shouldn't be pointing at anything after it's temporary job is done. Is this being overprotective? This would leave me continually resetting the pointer's value to null. Is it really even necessary to do that all the time?
Thanks for the help.
Anyway, as I do this I am finding for several functions I am needing a temporary pointer to a Node. Is it poor form to repeatedly declare these temporary pointers as the functions require them (seems very repetitious), or better to just go ahead and declare a sort of all purpose pointer as a private variable for my Linked List class? My concern over the latter is having a pointer to an address when it really shouldn't be pointing at anything after it's temporary job is done. Is this being overprotective? This would leave me continually resetting the pointer's value to null. Is it really even necessary to do that all the time?
Thanks for the help.
