I'm working on my load function to obtain the "word" from dictionary and I obtain one of the next message
dictionary.c:59:28: error: use of undeclared identifier 'word'; did you mean 'load'? while(fscanf(Dict,"%c",word))
The node for word is defined as;
typedef struct node
{
char word[LENGTH + 1];
struct node *next;
}
node;
Could I consider when entering dictionary word as a "full" word (string, as a string is a *char)? Why isn't word identified?
my code is
bool load(const char *dictionary)
{
// Opens dictionary
FILE *Dict = fopen(dictionary,"r");
if(Dict==NULL)
{
printf("Could not open Dictionary\n");
return false;
}
// Read strings from Dictionary
while(fscanf(Dict,"%c",word))
{
node *new_word = malloc(sizeof(node));
if(new_word == NULL)
{
fclose(Dict);
return false;
}
else // Hash table
{
strcpy(new_word->word,word); //Copies word to new_word node
new_word->next=table[hash(word)]; // Next pointer to NULL at first, then first linked list
table[hash(word)]=new_word; // hash table pointer to
}
}
return false;
}