I am writing a program where i need to open a file and store the data from the file into an array.
Ex(what is in the file):
por, because
be, ser
in, en
now I keep getting these error
- 5csce.c:21:5: warning: format â%sâ expects argument of type âchar *â, but argument 3 has type âchar (*)[2]â [-Wformat]
- 5csce.c:21:5: warning: format â%sâ expects argument of type âchar *â, but argument 4 has type âchar (*)[2]â [-Wformat]
- 5csce.c:27:1: warning: format â%sâ expects argument of type âchar *â, but argument 2 has type âintâ [-Wformat]
what does it mean?
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
FILE * pFile;
char words[100][2];
//open file
pFile = fopen("words.dat", "r");
//Read date and store in an array
fscanf(pFile, "%s, %s", words, words);
// close fiel
fclose(pFile);
printf("%s\n", words[0][0], words [0][1]);
return 0;
}