Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Linked List Question

Options
  • 03-05-2004 5:47pm
    #1
    Closed Accounts Posts: 2,039 ✭✭✭


    I searched the forum for Linked lists and got some results but they didn't really help much so here goes.

    I'm doing a college project and I'm almost finished but I've run into a problem. The task is to maintain a doubly linked list of names. The program breaks when I try to insert an item or delete an item. From what I can tell it's the srtcmp bit in the insert and erase procedures thats causing the problem I just don't know how to fix it. Any help would be really appreciated.

    The code I have so far is in the attached file. It's in a text file so you'll have to resave it as a .cpp file.


    Cheers
    Rory


Comments

  • Registered Users Posts: 1,986 ✭✭✭lynchie


    while(curr != NULL || strcmp(curr->Name,arr)

    You are using an || statement. curr can be null on the left side of the condition and when it goes to evaluate the right side of the condition curr->Name will be null. This is causing your error. Didnt look over the code in detail but maybe you need to use and && statement instead?


Advertisement