Assigning values to arrays using fscanf
For a project for my intro C programming course, I need to read values from a file and store those in an array. The file is in two columns, and i need to store the contents of one column in one array, and of the second column in the second array. Unfortunately, the code I have doesn't seem to be working at all and I don't know why.
Here's the code I have:
STUDENTS is defined as being equal to 100, the total number of lines in the file.
void datatoarray(int section, int scores)
file = fopen("exam1.txt", "r");
for (lcv = 1; lcv > STUDENTS; lcv++)
fscanf(file, "%d %d", §ion[lcv], %scores[lcv]);
The file looks like this:
and so on...
This is probably a really simple problem, but any help would be appreciated. Thanks!