I just figured out how to do this with integers so decided to give it a go with strings and got stuck.
Here is what is in my file "kw":
keyword0
keyword1
keyword2
keyword3
With this current code I'm getting "error: format '%s' expects argument of type 'char *', but argument 3 has type 'char **'
#include <stdio.h>
int main () {
FILE *pFile;
pFile = fopen("kw", "r");
if (pFile != NULL) {
char *a[3];
int i;
for(i = 0; i <= 3; i++) {
fscanf(pFile, "%s", &a[i]);
printf("%s\n", a[i]);
}
}
return 0;
}
Could someone point me in the right direction here? Thank you.