i'm taking a programming class in C and i am trying to make a dictionary with symbols and letters for a program ex. A = ?, B =! and so on.
the letter and it's defined symbol are saved in a text file, each in a line so:
A ?
B !
C =
D &
etc...
i'm using FILE * fPointer
and gets
to read and save line by line with a while loop,
i want to save each line in an array :
#include <stdio.h>
int main()
{
FILE * fPointer;
fPointer = fopen("symbols.txt", "r");
char line[50];
char vocab[36];
while(!feof(fPointer))
{
for(int i=0;i<=36;i++)
{
fgets(line, 50, fPointer);
vocab[i] = line;
printf("%s", vocab[i]);
}
}
}
Ideally, it would be saving each line in the array position vocab[0] = "A ?" vocab[1] = "B !" ...
It gives me the next warning: assignment makes integer from pointer without a cast,