0

I'm in the middle of implementing Speller, I've just got the 'Load' to work in a separate test file.

My question is how to insert the function into the distribution code? That is:

How can I insert other functions I've prototyped into dictionary.c?

Can i still include libraries into dictionary.c?

Can I #define in dictionary.c?

Can I typedef struct in dictionary.c?

Basically is there anything I should watch out for when I move the working implementation of 'load' from my own test file to dictionary.c

Thanks very much,

Tikhon

0

This is super basic stuff but had the potential to really screw me over as i implemented most of my code in a separate file...

It worked by just dumping it all in there. I was careful to insert functions in the order that I need them - otherwise it wouldn't work. So, for instance, my own function:

void insert_front(char member[LENGTH + 1], node ** first)

had to be prototyped BEFORE:

bool load(const char *dictionary)

because the latter used the former.

I also defined a global variable node * hashtable[1001] by declaring it outside of any function. That way all the functions could use it. For instance in my test file I had to feed the hashtable into the check function

bool check(const char *word, node * hashtable[1001])

but in dictionary.c I got away with

bool check(const char *word)

because hashtable was already globally defined.

You must log in to answer this question.

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