|
-
October 22nd, 2004, 12:05 PM
#6
Re: Linked List search() and delete() trouble
 Originally Posted by cma
And you should do
Code:
return (*lptr != NULL);
since the way you have it, it will always return true.
I understand, but it does return false sometimes when written as "lptr != NULL". I have filled a linked list with ascending integers from 1 to 25, then wrote a loop starting at 1 and incrementing by two every pass (essentially, odd numbers) and removed the incrementer value from the list every pass.
Either way I write it, I still end up with a linked list filled only with even numbers, just as expected... why? Could it be the system I run it on (FreeBSD UNIX/Mac OS X)?
Strage... it runs fine on my Mac OS X box, it runs fine on a Solaris box... but on a Fedora Core 2 box, it throws a segmentation fault and dumps the core.
Power Macintosh G4/500 PCI
OS X 10.5.4 • 1024MB RAM • 120GB x 3 • Pioneer DVR-111D CD-RW/DVD-RW • Radeon 7000 PCI x 2, dual 17" Displays
http://www.jeffhoppe.com
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|