943,981 Members | Top Members by Rank

Ad:
  • C Discussion Thread
  • Marked Solved
  • Views: 1728
  • C RSS
Nov 28th, 2007
0

Memory refrence error when printing linked list

Expand Post »
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
Reputation Points: 10
Solved Threads: 3
Junior Poster
Barefootsanders is offline Offline
165 posts
since Oct 2006
Nov 28th, 2007
0

Re: Memory refrence error when printing linked list

Also, btw, when I change the number of elements in the list and attempt to print that it works.. strange.
Reputation Points: 10
Solved Threads: 3
Junior Poster
Barefootsanders is offline Offline
165 posts
since Oct 2006
Nov 29th, 2007
0

Re: Memory refrence error when printing linked list

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.
Team Colleague
Reputation Points: 5862
Solved Threads: 950
Posting Sage
Salem is offline Offline
7,164 posts
since Dec 2005
Nov 29th, 2007
0

Re: Memory refrence error when printing linked list

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.
Reputation Points: 10
Solved Threads: 3
Junior Poster
Barefootsanders is offline Offline
165 posts
since Oct 2006

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C Forum Timeline: tell me abut a new large gamin program or some management program
Next Thread in C Forum Timeline: command line string swap





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC