I am scanning a string from a file and storing it into an array of strings. When I compile my program, it does not produce any error but when I run it, it says Segmentation fault (core dumped)
. I know that the error is in the fscanf statement, but I can't figure out what's wrong.
My code looks like this:
FILE *stringsIn = fopen("strings.txt", "rt");
char *strings[INPUT_STRINGS];
for (int i = 0; i < INPUT_STRINGS; i++)
fscanf(stringsIn, "%s ", &strings[i][0]);