954,506 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Memory refrence error when printing linked list

I have a doubly linked list and I know it gets created with the proper values. For some reason when I run through my print function it, only prints 1/2 of the list and then gives me this:

the instruction at "0x7c93426d" referenced memory at "0x00000000". the memory could not be "read".

I'm assuming it's trying to reference a NULL pointer but I dont know how 1/2 the list gets printed and the other 1/2 all of a sudden is NULL. Are there any common problems associated with printing linked lists like this?

Thanks

Barefootsanders
Junior Poster
166 posts since Oct 2006
Reputation Points: 10
Solved Threads: 3
 

Also, btw, when I change the number of elements in the list and attempt to print that it works.. strange.

Barefootsanders
Junior Poster
166 posts since Oct 2006
Reputation Points: 10
Solved Threads: 3
 

Post the code which
- creates nodes
- adds them to the list
- prints the list.

There's nothing strange when it's implemented correctly, so I'm just going with there are bugs in your code.

Salem
Posting Sage
Team Colleague
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953
 

Hey sorry. You were right and I was implementing it incorrectly. I was passing a NULL pointer to my print function and it crashed. Thanks for the input.

Barefootsanders
Junior Poster
166 posts since Oct 2006
Reputation Points: 10
Solved Threads: 3
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You