whats wrong with my code. i get this error while compiling
Code:
gcc -ggdb -std=c99 -Wall -Werror -c -o dictionary.o dictionary.c
dictionary.c: In function 'load':
dictionary.c:58:21: (32 in the abbreviated code below) error: assignment makes pointer from integer without a cast [-Werror]
cc1: all warnings being treated as errors
Code:
typedef struct node
{
char *word;
struct node *next;
} node;
bool
load(const char *dictionary)
{
// open dictionary
FILE *fp = fopen(dictionary, "r");
if (fp == NULL)
{
printf("Error opening dictionary");
return 1111;
}
// link list of words
node *dict_list = malloc(sizeof(node));
// read current word
int counter = 0;
char *word;
for (char c = fgetc(fp); c != '\0'; c = fgetc(fp)) // loop through chars until end of word
{
word[counter] = c; // add chars to current word
counter++;
}
word[counter] = '\0'; // word is finished reading
// save current word
dict_list->word = *word;
// dictionary has been loaded
return true;
}