It's no wonder it crashes, with so many problems.
Code:
$ gcc -Wall -Wextra foo.c
foo.c: In function ‘main’:
foo.c:17:21: warning: assignment makes pointer from integer without a cast [enabled by default]
foo.c:17:34: warning: comparison between pointer and integer [enabled by default]
foo.c:17:49: warning: comparison between pointer and integer [enabled by default]
foo.c:17:65: warning: comparison between pointer and integer [enabled by default]
foo.c:19:13: warning: passing argument 2 of ‘realloc’ makes integer from pointer without a cast [enabled by default]
/usr/include/stdlib.h:485:14: note: expected ‘size_t’ but argument is of type ‘char *’
foo.c:5:14: warning: unused parameter ‘argc’ [-Wunused-parameter]
foo.c:5:26: warning: unused parameter ‘argv’ [-Wunused-parameter]
foo.c:19:20: warning: ignoring return value of ‘realloc’, declared with attribute warn_unused_result [-Wunused-result]
Think about what kind of 'array' of strings you need.
You can have one of 4 choices.
Code:
char strings[10][100]; // fixed number of strings, fixed maximum length
char *strings[10]; // fixed number of strings, variable length of each
char (*strings)[100]; // variable number of strings, fixed maximum length
char **strings; // variable number of strings, with variable length
I suggest you start with the first one, to allow you to focus on your 'read a single word' from the file to begin with.
When that works, you can move onto how to allocate and store the string in your chosen array.