So I finished speller and am debugging and getting a segmentaiton error when I am trying to set the array in my root node to NULL.
I have defined my Struct at the beginning of Dictionary.c and declared root there too :-
typedef struct node
{
bool endOfWord;
struct node* child[27];
}
node;
node* root;
Then in load I iterate over roots array setting them to NULL:-
for(int i = 0; i < 27; i++)
{
root -> child[i] = NULL;
}
and that is where GDB is telling me I have a problem:-
Program received signal SIGSEGV, Segmentation fault.
0x08049004 in load (dictionary=0x80495c2 "/home/cs50/pset5/dictionaries/large") at dictionary.c:74
74 root -> child[i] = NULL;
Not sure what I'm doing wrong. Should I be using malloc to allocate memory to root?