C Board  

Go Back   C Board > General Programming Boards > C Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 12-02-2009, 05:59 AM   #1
Registered User
 
Join Date: Dec 2009
Posts: 5
a problem with pointers

I have a doublylinked-list which i already inserted some values, but when i try to make search&update this loop does not terminate

Code:
if(head!=NULL)
    {
        temp = head;
        while(temp!=NULL)
        {
            if(temp->row==i)
                temp->data = 100;
            else
                 temp=temp->next;
        }
    }
although i get 0 when i check tail->next, temp never becomes NULL. How can i solve this problem?
carter88 is offline   Reply With Quote
Old 12-02-2009, 06:36 AM   #2
Jack of many languages
 
Dino's Avatar
 
Join Date: Nov 2007
Location: Katy, Texas
Posts: 2,131
If temp never becomes null, then your list must be self referencing and you are going into a loop.
__________________
Mac and Windows cross platform programmer. Ruby lover.
Dino is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with file handling (pointers) hmk C Programming 5 09-19-2008 10:03 AM
Problem with pointers kotoko C Programming 3 06-12-2008 05:17 AM
A problem with pointers vsla C Programming 2 10-10-2007 04:14 AM
Returning pointer to array of pointers problem jimzy C Programming 15 11-11-2006 06:38 AM
Problem writing swap using pointers joshdick C++ Programming 1 02-29-2004 10:06 PM


All times are GMT -6. The time now is 12:11 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22