I have a text file in which the data is like this:
SHANGHAI 13831900
ISTANBUL 13120596
KARACHI 12991000
DELHI 12565901
...
It goes on like this with city names and populations. I want to have such a code that it will assign every city and population to a certain element of the array A[] after it reads the file. That is, then I want to have this:
A[0]=SHANGHAI
A[1]=13831900
A[2]=ISTANBUL
A[3]=13120596
...
I could only do the reading file part like this:
Code:
  FILE * fPtr;
  fPtr = fopen("POPULATIONS.TXT", "r");
What should I do next, please could you help?