Thread: linked lists, strcmp(), char array, & a structure

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    essence of digital xddxogm3's Avatar
    Join Date
    Sep 2003
    Posts
    589

    Question linked lists, strcmp(), char array, & a structure

    I'm trying to use information that is stored in a linked list node to compare it to a key. The data in the node is a char array in a structure. The key is a user inputed char array. I want to compare the two for a sort of the linked list. Last name to Last name. It doesn't work. I'm unable to see why it doesn't work.

    Below is the code I'm using.
    Code:
    //prototype 
    bool compare(const char*,const char*);
    
    //key declaration
    char  Key[SIZE];
    
    //structure definition
    struct link                          
    {
    short age;
    short weight;
    char fname[SIZE];
    char lname[SIZE];
    char ssnumber[SIZE];
    link *next;                       
    };
    
    //my function call
    compare(current->lname,Key)
    
    //definition function
    bool compare(const char* node,const char* key)
    {
    	if(strcmp(node,key))
    		return true;
    	else
    		return false;
    }
    I get the following errors
    (1)linked lists error LNK2019: unresolved external symbol "private: bool __thiscall linklist::compare(char const *,char const *)" (?compare@linklist@@AAE_NPBD0@Z) referenced in function "public: void __thiscall linklist::delete_key(void)" (?delete_key@linklist@@QAEXXZ)
    (2)linked lists fatal error LNK1120: 1 unresolved externals
    Last edited by xviddivxoggmp3; 10-04-2003 at 02:43 PM.
    "Hence to fight and conquer in all your battles is not supreme excellence;
    supreme excellence consists in breaking the enemy's resistance without fighting."
    Art of War Sun Tzu

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Fill a linked list char by char
    By w2look in forum C Programming
    Replies: 6
    Last Post: 03-26-2009, 03:07 PM
  2. Unknown memory leak with linked lists...
    By RaDeuX in forum C Programming
    Replies: 6
    Last Post: 12-07-2008, 04:09 AM
  3. Linked Lists 101
    By The Brain in forum C++ Programming
    Replies: 5
    Last Post: 07-24-2004, 04:32 PM
  4. need help w/ linked lists
    By MKashlev in forum C++ Programming
    Replies: 11
    Last Post: 08-05-2002, 08:57 PM
  5. Hi, could someone help me with arrays?
    By goodn in forum C Programming
    Replies: 20
    Last Post: 10-18-2001, 09:48 AM