Doubly Linked List

Page 2 - Seeking answers? Join the AnandTech community: where nearly half-a-million members share solutions and discuss the latest tech.

reverend boltron

Senior member
Nov 18, 2004
945
0
76
Hm, that gives me a different answer.. the screen fills up with 14's. I'll look into my pointers to make sure they're done properly. Thanks a lot though, I really appreciate all of your help guys.
 

igowerf

Diamond Member
Jun 27, 2000
7,697
1
76
Originally posted by: reverend boltron
Hm, that gives me a different answer.. the screen fills up with 14's. I'll look into my pointers to make sure they're done properly. Thanks a lot though, I really appreciate all of your help guys.

Beggarking is right that the OR should be an AND. Look at my above post.
 

reverend boltron

Senior member
Nov 18, 2004
945
0
76
Originally posted by: igowerf
Originally posted by: reverend boltron
Hm, that gives me a different answer.. the screen fills up with 14's. I'll look into my pointers to make sure they're done properly. Thanks a lot though, I really appreciate all of your help guys.

Beggarking is right that the OR should be an AND. Look at my above post.

Yeah, actually, if you look at my post you'll see that I grasped what Beggarking said. I drew it out and it makes perfect sense. So now I'm just looking through my pointers and seeing if they're all being kept track of properly. Because now I'm at least getting information instead of a crash. Which is definitely a plus.
 

reverend boltron

Senior member
Nov 18, 2004
945
0
76
Hey! You're brilliant! Good job! Now I've got another error, but still, I'm past that part. Thank you so much man. Seriously, I really do appreciate this.
 

reverend boltron

Senior member
Nov 18, 2004
945
0
76
Sorry to keep on asking questions, but I'm having problems with the destructor. The whole program is working fine, it's just messing up when it is calling the destructor.

Like, according to the test program, it works fine, and everything prints out just fine and dandy, except that it crashes at the end.

Edit: Nevermind, I just fixed it. Seriously guys, thanks so much for your help. I really appreciate it.
 

beggerking

Golden Member
Jan 15, 2006
1,703
0
0
:) glad to be of help.

btw, the destructor should be

current = first->next
// keep deleting until all nodes in the list are gone
while (current->Next->next != NULL)
DeleteCurrent();
// then delete the dummy first node, too
delete First;
delete Last;