Thread: Searching for a string in an 'dictionary' array

  1. #1
    Registered User
    Join Date
    Nov 2012
    Posts
    8

    Searching for a string in an 'dictionary' array

    Hello I'm having some problems with this. I am trying to search for a string, via user input, through a dictionary to see if the word matches.
    Code:
    typedef struct{
        bool found;
        char letters[LETTERS + 1];
    }
    word;
    
    
    // defines a dictionary as having a size and an array of words
    struct
    {
        int size;
        word words[WORDS];
    }
    dictionary;
    The word is an array of letters so how would I check to see if a string is equal to the word array inside the dictionary?

  2. #2
    SAMARAS std10093's Avatar
    Join Date
    Jan 2011
    Location
    Nice, France
    Posts
    2,694
    Code - functions and small libraries I use


    It’s 2014 and I still use printf() for debugging.


    "Programs must be written for people to read, and only incidentally for machines to execute. " —Harold Abelson

  3. #3
    Registered User
    Join Date
    Nov 2012
    Posts
    8
    Thankyou very much!

  4. #4
    SAMARAS std10093's Avatar
    Join Date
    Jan 2011
    Location
    Nice, France
    Posts
    2,694
    You are welcome.
    Code - functions and small libraries I use


    It’s 2014 and I still use printf() for debugging.


    "Programs must be written for people to read, and only incidentally for machines to execute. " —Harold Abelson

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. convert Dictionary to array
    By Dale in forum C# Programming
    Replies: 4
    Last Post: 11-28-2011, 03:35 AM
  2. Replies: 9
    Last Post: 08-23-2010, 02:31 PM
  3. Dictionary into a 2d Char Array... Problems.
    By Muzzaro in forum C Programming
    Replies: 10
    Last Post: 12-02-2006, 12:34 PM
  4. partially checking a string against a dictionary
    By axon in forum C++ Programming
    Replies: 2
    Last Post: 03-11-2003, 06:16 PM
  5. Not getting good result searching an array of string.
    By cazil in forum C++ Programming
    Replies: 5
    Last Post: 02-12-2002, 11:24 AM