0

I have (hopefully) loaded the dictionary correctly, but I'm not clear on how to identify its location in memory without changing the declaration of the load function?

More concretely, in my code for load, I have this:

node* hashtable[26]

(My first pass at this hashes on the first letter -- I'm not optimizing.)

I would think I need to return something like &hashtable, along with true or false, but we are told not to alter function declarations.

This makes me wonder if I should declare it as some sort of global variable in my .c or .h file, but I'm not sure how to do that. Can we do something like:

#define node* hashtable[26]

...at the top of the file? I tried, and it didn't work.

1 Answer 1

0

You're on the right track with a global variable. Just declare it at the top of the code, after the includes and defines, but before main or any other functions. Also, don't use #define.

Also, if you declare it as a node pointer, you have to declare those first, using typedef.

If this answers your question, please accept this answer to remove the question from the unanswered question pool. Let's keep up on forum housekeeping. ;-)

0

You must log in to answer this question.

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