0

// Returns true if word is in dictionary else false

bool check(const char *word) {

//Variables
bool looping = true;
int hashWord = hash(word);

//Create a new pointers
node *head = table[hashWord];
node *cursor = head;

//Loop
while (looping)
{
    int result = strcasecmp(cursor->word, word);
    cursor = cursor->next;

    if (result == 0)
    {
        looping = false;
        return true;
    }
    //If cursor is NULL exit loop and return false
    if (cursor == NULL)
    {
        looping = false;
    }
}
return false;

}

I can't seem to know were the error is.

enter image description here

  • Edit: I just solved :D But my questions is that I saw someone that set num of words in the dictionary to -1, why is that? – DeHacker17 Jul 25 '20 at 3:40

You must log in to answer this question.

Browse other questions tagged .