I have been using Slack exclusively up to this point but, I figured I would give SE a try (plus my boss is out today and I have some free time.)
I am working on PSET 5's check(). The error that I receive with the below code is a segmentation fault. After running GDB I assume the segmentation fault occurs at the if (newNode->children[c] == NULL). I unfortunately can not post the GDB deets as I do not have access to them at work. So I have three questions that will surely lead me in the right direction.
1_This has to due with the case insensitivity. If I understand correctly, we do have to take some action to make sure all the letters are lowercase. Is that correct? If so, would a to lower function after the first else work, for example something like
(tolower(c) - 'a')
2_This has to do with the go to corresponding element in children. Is the below correct? The mini dictionary that I implemented has a first word of 'baby' and I am fairly certain it is not making it past the first letter which leads me to believe I have made the mistake early on.
3_I am seeing now where I could have another mistake but I will not be able to check it until I get home but, anyhow, I think the isWord line is incorrect as well. Should it rather be if (newNode->isWord == 0), something like that? I am not following the instructions with my current code below because I am not checking if the isWord is true.
Let me know what you think, community! Thanks in advance.
EDIT: I have added the tolower(c) and the edited the isWord line. Still getting a segmentation fault and still confused.
if (newNode->children[c] == NULL)
EDIT EDIT: The problem has been solved /code taken down.