0

I am getting the following valerind error.

==9649== Conditional jump or move depends on uninitialised value(s)
==9649==    at 0x80493AD: check (dictionary.c:152)
==9649==    by 0x8048A6D: main (speller.c:119)
==9649==

Here is my code around dictionary.c:152. This is basically a string compare that takes into account capitalization.

for (spell = fletter[fletterc]; spell!= NULL; spell=spell->next)
{
    for (int j=0; spell->n[j] != '\0'; j++)
    {
        char letterx = spell->n[j];
        char lettery = word[j];
        if (letterx != lettery && letterx +('a'-'A') != lettery && letterx-('a'-'A') != lettery)
        {
            break;
        }
        else if (word[j+1] == '\0')
        {
            return true;
        }
    }
}
4
  • No it's not the same mistake as that one. The program seems to run perfectly well: There are 4 errors in this one location, so it doesn't seem to be related to hash table size or the looping. There don't seem to be any unnecessary malloc's and everything else is initialized to NULL. I have freed all memory leaks. Would you like to see the full code? Apr 11, 2015 at 16:33
  • ok I am an idiot!: I forgot to put the '/0' on all my dictionary words. Shouldn't be too hard to fix. Apr 11, 2015 at 17:09
  • The idea is the same. You never initialize a variable and yet your trying to compare it's value with another value.
    – kzidane
    Apr 11, 2015 at 19:43

1 Answer 1

0

So I forgot to put the '/0' on all my dictionary words since I was using the fgetc and not fscanf, which caused some issues when I tried to compare the strings in my checker.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .