Start like this:
Code:
//header files
struct census
{
char street_name[20];
int house_number;
int occupants;
};
//notice it's int main, not void main
int main()
{
struct census record[50];
FILE *fptr;
int count=0; //using count as iteration marker
//open the file
fptr = fopen("filepath","r");
if(fptr == NULL) exit(1);
while(fscanf(fptr, "format specifiers", variables) != EOF)
{
//load records
//........................................................................
..........................some code
//count += 1; //increment count
}
//Now from this struct i need to colate the following info,
return 0;
}
You are required to load the data from the file into variables (ie records) in order to make comparisons on it. If you do not understand this from this code than you need to read several chapters such as: 'file I/O' and 'structures'.