![]() |
| | #1 |
| Registered User Join Date: Nov 2001
Posts: 1
| i am making use of pointers. |
| susyb is offline | |
| | #2 |
| Skunkmeister Join Date: Aug 2001
Posts: 2,572
| a doubly linked list looks like this..... Code: NULL <--root(node0) <----> node1<---->node2<---->node3---->NULL node1 has a pointer to node 2 but also has a pointer to root. if we wanted to delete node1.... node2 pointer to node 1 would have to point to root root pointer to node1 would be altered to point to node2 Dont forget to free memory associated with node1. You now have this sort of structure. Code: NULL <--root<---->node2<---->node3---->NULL root pointer to node2 altered to point to node4 node4 pointer(prev.) set to root node4 pointer(next) set to node2 node2 pointer to root altered to point to node4. ending up with.... Code: NULL <--root <----> node4<---->node2<---->node3---->NULL
__________________ Free the weed!! Class B to class C is not good enough!! And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi |
| Stoned_Coder is offline | |
| | #3 |
| Guest
Posts: n/a
| Pretty good explanaition of linked lists there. But do you (or anyone else) know of any GOOD tut's or books that deal with linked lists. I've read a couple of them including the short one on this site and understand the logic behind deleting and adding nodes but would like to see a few examples of how different people implement this in code. Im about to write a small prog for storing records in a binary file for my class. |
|
| | #4 |
| Skunkmeister Join Date: Aug 2001
Posts: 2,572
| do a search at google for linked lists. search for a c implementation to see the code properly. In c++ linked lists are normally done a little different by using the stl.
__________________ Free the weed!! Class B to class C is not good enough!! And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi |
| Stoned_Coder is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Double pointers and linked lists. | simo_r | C Programming | 2 | 05-06-2008 04:25 AM |
| Singly Linked Lists: Clarification Needed | jedispy | C++ Programming | 4 | 12-14-2006 05:30 PM |
| need some help with last part of arrays | Lince | C Programming | 3 | 11-18-2006 09:13 AM |
| Double linked lists and a structure to hold them plus a name. | Nit | C Programming | 1 | 03-21-2002 06:10 PM |
| doubly linked lists | qwertiop | C++ Programming | 3 | 10-03-2001 06:25 PM |