I'm given a struct:
struct Agency {
char name[255];
int zip[5];
RentalCar inventory[5]; // array of RentalCar objects
};
I need to retrieve data from a file to fill an array of 3 Agency objects. To set the values for the first item in the inventory array is easy,
Agency ag[3];
for (int i = 0; i < 3; i++) {
ag->inventory->setWhatever();
ag++; // easy to iterate through this array
}
But It's not that easy to iterate through the inventory array within the agency array.
inventory++; // doesn't know what object this is associated with
ag->inventory++; // also doesn't work
RentalCarfrom the file?