Ok you've created an array of 21 INFO items...
Code:
INFO list[NUM_LINE];
Then you call your function...
Code:
void getData(FILE *spData, INFO list[NUM_LINE])
but you only pass in one item in the array... #21...
However... You have an array of 21 items. In C arrays start at 0, not 1... so an array with 21 items has valid indexes from 0 to 20... not 1 to 21... thus element 21 is actually out of bounds for the array.
You need to pass in a pointer...
Code:
void getData(FILE* spData,INFO *list);
Which you would call as...
Code:
getData(spData,list);
then in your loop you load your array like it's a single struct...
Code:
fscanf(spData,"%s %s %d", list->states, list->cities, list->tempt );
In this case #21... which is out of bounds.
The correct notation is more like...
Code:
fscanf(spData,"%99s %99s %d", list[i].states, list[i].cities, list[i].tempt);